Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added a spec to cover r2916

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@2917 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
commit af9304d7858c1da8b007c4808157c425a2bfbde3 1 parent 3976f47
Laurent Sansonetti authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 spec/macruby/core/pointer_spec.rb
View
14 spec/macruby/core/pointer_spec.rb
@@ -112,10 +112,22 @@ def coercable_object.to_f; 42.0; end
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
Please sign in to comment.
Something went wrong with that request. Please try again.