[macruby-changes] [3508] MacRuby/trunk/spec/frozen/core/hash/compare_by_identity_spec.rb

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 11 22:02:55 PST 2010


Revision: 3508
          http://trac.macosforge.org/projects/ruby/changeset/3508
Author:   lsansonetti at apple.com
Date:     2010-02-11 22:02:55 -0800 (Thu, 11 Feb 2010)
Log Message:
-----------
fixed a stupid spec (not sure if it's the right way to do it...)

Modified Paths:
--------------
    MacRuby/trunk/spec/frozen/core/hash/compare_by_identity_spec.rb

Modified: MacRuby/trunk/spec/frozen/core/hash/compare_by_identity_spec.rb
===================================================================
--- MacRuby/trunk/spec/frozen/core/hash/compare_by_identity_spec.rb	2010-02-12 06:02:08 UTC (rev 3507)
+++ MacRuby/trunk/spec/frozen/core/hash/compare_by_identity_spec.rb	2010-02-12 06:02:55 UTC (rev 3508)
@@ -22,20 +22,37 @@
       h.compare_by_identity.should == h
     end
     
-    it "uses the semantics of BasicObject#equal? to determine key identity" do
-      1.1.should_not equal(1.1)
-      @idh[1.1] = :a
-      @idh[1.1] = :b
-      [1].should_not equal([1])
-      @idh[[1]] = :c
-      @idh[[1]] = :d
-      :bar.should equal(:bar)
-      @idh[:bar] = :e
-      @idh[:bar] = :f
-      "bar".should_not equal('bar')
-      @idh["bar"] = :g
-      @idh["bar"] = :h
-      @idh.values.should == [:a, :b, :c, :d, :f, :g, :h]
+    if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'macruby'
+      # MacRuby needs its own version of this example because
+      # 1.1.equal?(1.1) returns true.
+      it "uses the semantics of BasicObject#equal? to determine key identity" do
+        [1].should_not equal([1])
+        @idh[[1]] = :a
+        @idh[[1]] = :b
+        :bar.should equal(:bar)
+        @idh[:bar] = :c
+        @idh[:bar] = :d
+        "bar".should_not equal('bar')
+        @idh["bar"] = :e
+        @idh["bar"] = :f
+        @idh.values.should == [:a, :b, :d, :e, :f]
+      end
+    else
+      it "uses the semantics of BasicObject#equal? to determine key identity" do
+        1.1.should_not equal(1.1)
+        @idh[1.1] = :a
+        @idh[1.1] = :b
+        [1].should_not equal([1])
+        @idh[[1]] = :c
+        @idh[[1]] = :d
+        :bar.should equal(:bar)
+        @idh[:bar] = :e
+        @idh[:bar] = :f
+        "bar".should_not equal('bar')
+        @idh["bar"] = :g
+        @idh["bar"] = :h
+        @idh.values.should == [:a, :b, :c, :d, :f, :g, :h]
+      end
     end
 
     it "doesn't call #equal? on keys to determine their identity" do
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100211/a1fa6f8d/attachment.html>


More information about the macruby-changes mailing list