Revision: 3941 http://trac.macosforge.org/projects/ruby/changeset/3941 Author: lsansonetti@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 +@interface TestCustomMethodResolver : NSObject +@end + +@implementation TestCustomMethodResolver + ++ (BOOL)resolveInstanceMethod:(SEL)name +{ + return NO; +} + ++ (BOOL)resolveClassMethod:(SEL)name +{ + return NO; +} + +@end + void Init_object(void) {}
participants (1)
-
source_changes@macosforge.org