Modified: MacRuby/trunk/spec/macruby/core/pointer_spec.rb (3945 => 3946)
--- MacRuby/trunk/spec/macruby/core/pointer_spec.rb 2010-04-20 23:14:30 UTC (rev 3945)
+++ MacRuby/trunk/spec/macruby/core/pointer_spec.rb 2010-04-20 23:14:49 UTC (rev 3946)
@@ -170,3 +170,19 @@
lambda { pointer[3] = 42 }.should raise_error(ArgumentError)
end
end
+
+describe "A Pointer object" do
+ it "can have its type changed using #cast!" do
+ pointer = Pointer.new(NSRect.type)
+ pointer[0] = NSMakeRect(10, 20, 30, 40)
+
+ val = NSValue.valueWithPointer(pointer)
+ pointer2 = val.pointerValue
+ pointer2.class.should == Pointer
+ pointer2.type == 'v'
+
+ pointer2.cast!(NSRect.type).should == pointer2
+ pointer2.type.should == NSRect.type
+ pointer2[0].should == NSMakeRect(10, 20, 30, 40)
+ end
+end