[macruby-changes] [4940] MacRuby/trunk/spec/macruby/core/object_spec.rb

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 22 20:11:47 PST 2010


Revision: 4940
          http://trac.macosforge.org/projects/ruby/changeset/4940
Author:   lsansonetti at apple.com
Date:     2010-11-22 20:11:45 -0800 (Mon, 22 Nov 2010)
Log Message:
-----------
add another test for the new conformsToProtocol: feature

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

Modified: MacRuby/trunk/spec/macruby/core/object_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/object_spec.rb	2010-11-23 04:10:51 UTC (rev 4939)
+++ MacRuby/trunk/spec/macruby/core/object_spec.rb	2010-11-23 04:11:45 UTC (rev 4940)
@@ -43,6 +43,15 @@
     o = TestObjectThatConformsToProtocol.new
     conforms = TestProtocolConformance.checkIfObjectConformsToTestProtocol(o)
     conforms.should == 1
+
+    o = Class.new.new
+    prot = Protocol.protocolWithName(:NSCoding)
+    o.conformsToProtocol(prot).should == false
+    def o.initWithCoder(coder); nil; end
+    o.conformsToProtocol(prot).should == false
+    def o.encodeWithCoder(coder); nil; end
+    o.conformsToProtocol(prot).should == true
+    o.conformsToProtocol(prot).should == true # again, as it's now cached
   end
 end
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101122/95250311/attachment.html>


More information about the macruby-changes mailing list