[macruby-changes] [2917] MacRuby/trunk/spec/macruby/core/pointer_spec.rb

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 28 21:09:50 PDT 2009


Revision: 2917
          http://trac.macosforge.org/projects/ruby/changeset/2917
Author:   lsansonetti at apple.com
Date:     2009-10-28 21:09:49 -0700 (Wed, 28 Oct 2009)
Log Message:
-----------
added a spec to cover r2916

Revision Links:
--------------
    http://trac.macosforge.org/projects/ruby/changeset/2916

Modified Paths:
--------------
    MacRuby/trunk/spec/macruby/core/pointer_spec.rb

Modified: MacRuby/trunk/spec/macruby/core/pointer_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/pointer_spec.rb	2009-10-29 04:02:33 UTC (rev 2916)
+++ MacRuby/trunk/spec/macruby/core/pointer_spec.rb	2009-10-29 04:09:49 UTC (rev 2917)
@@ -112,10 +112,22 @@
     end
   end
 
-  it "can assign an retrieve CF type objects" do
+  it "can assign and retrieve CF type objects" do
     ptr = Pointer.new('^{__CFError}')
     ptr[0].should == nil
     CFURLResourceIsReachable(NSURL.URLWithString('http://doesnotexistomgwtf.be'), ptr).should == false
     ptr[0].class.should == NSCFError
   end
+
+  it "handle 'void *' C pointers as 'unsigned char *'" do
+    ptr = 'hey'.dataUsingEncoding(NSMacOSRomanStringEncoding).bytes
+    ptr.class.should == Pointer
+    ptr.type.should == 'C'
+    ptr[0].class.should == Fixnum
+    ptr[0].chr.should == 'h'
+    ptr[1].class.should == Fixnum
+    ptr[1].chr.should == 'e'
+    ptr[2].class.should == Fixnum
+    ptr[2].chr.should == 'y'
+  end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091028/6535f666/attachment-0001.html>


More information about the macruby-changes mailing list