[macruby-changes] [3941] MacRuby/trunk/spec/macruby
source_changes at macosforge.org
source_changes at macosforge.org
Sun Apr 18 14:12:14 PDT 2010
Revision: 3941
http://trac.macosforge.org/projects/ruby/changeset/3941
Author: lsansonetti at apple.com
Date: 2010-04-18 14:12:13 -0700 (Sun, 18 Apr 2010)
Log Message:
-----------
added specs for class with custom Objective-C method resolver
Modified Paths:
--------------
MacRuby/trunk/spec/macruby/core/object_spec.rb
MacRuby/trunk/spec/macruby/fixtures/object.m
Modified: MacRuby/trunk/spec/macruby/core/object_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/object_spec.rb 2010-04-18 21:11:41 UTC (rev 3940)
+++ MacRuby/trunk/spec/macruby/core/object_spec.rb 2010-04-18 21:12:13 UTC (rev 3941)
@@ -62,4 +62,14 @@
obj = NSPredicate.predicateWithFormat("NOT (SELF in %@)", argumentArray: [[1,2,3,4]])
obj.kind_of?(NSPredicate).should == true
end
+
+ it "with a custom Objective-C method resolver can still be used to add new methods from Ruby" do
+ class TestCustomMethodResolverSub < ::TestCustomMethodResolver
+ def foo; 42; end
+ alias_method :bar, :foo
+ end
+ o = TestCustomMethodResolverSub.new
+ o.foo.should == 42
+ o.bar.should == 42
+ end
end
Modified: MacRuby/trunk/spec/macruby/fixtures/object.m
===================================================================
--- MacRuby/trunk/spec/macruby/fixtures/object.m 2010-04-18 21:11:41 UTC (rev 3940)
+++ MacRuby/trunk/spec/macruby/fixtures/object.m 2010-04-18 21:12:13 UTC (rev 3941)
@@ -43,4 +43,21 @@
@end
+ at interface TestCustomMethodResolver : NSObject
+ at end
+
+ at implementation TestCustomMethodResolver
+
++ (BOOL)resolveInstanceMethod:(SEL)name
+{
+ return NO;
+}
+
++ (BOOL)resolveClassMethod:(SEL)name
+{
+ return NO;
+}
+
+ at end
+
void Init_object(void) {}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100418/37646ac2/attachment.html>
More information about the macruby-changes
mailing list