[macruby-changes] [1343] MacRuby/branches/experimental/spec/frozen

source_changes at macosforge.org source_changes at macosforge.org
Sat Apr 4 08:24:46 PDT 2009


Revision: 1343
          http://trac.macosforge.org/projects/ruby/changeset/1343
Author:   eloy.de.enige at gmail.com
Date:     2009-04-04 08:24:45 -0700 (Sat, 04 Apr 2009)
Log Message:
-----------
Added ruby_bug guards.

Modified Paths:
--------------
    MacRuby/branches/experimental/spec/frozen/core/float/constants_spec.rb
    MacRuby/branches/experimental/spec/frozen/language/super_spec.rb

Added Paths:
-----------
    MacRuby/branches/experimental/spec/frozen/core/hash/constructor_spec.rb

Modified: MacRuby/branches/experimental/spec/frozen/core/float/constants_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/float/constants_spec.rb	2009-04-04 15:24:30 UTC (rev 1342)
+++ MacRuby/branches/experimental/spec/frozen/core/float/constants_spec.rb	2009-04-04 15:24:45 UTC (rev 1343)
@@ -33,9 +33,11 @@
     Float::MAX.should == eval("179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0")
   end
 
-  not_compliant_on :jruby do
-    it "the MIN is 2.2250738585072e-308" do
-      Float::MIN.should == eval("2.225073858507201383090232717332404064219215980462331830553327416887204434813918195854283159012511020564067339731035811005152434161553460108856012385377718821130777993532002330479610147442583636071921565046942503734208375250806650616658158948720491179968591639648500635908770118304874799780887753749949451580451605050915399856582470818645113537935804992115981085766051992433352114352390148795699609591288891602992641511063466313393663477586513029371762047325631781485664350872122828637642044846811407613911477062801689853244110024161447421618567166150540154285084716752901903161322778896729707373123334086988983175067838846926092773977972858659654941091369095406136467568702398678315290680984617210924625396728515625e-308")
+  ruby_bug "", "1.8.6.362" do
+    not_compliant_on :jruby do
+      it "the MIN is 2.2250738585072e-308" do
+        Float::MIN.should == eval("2.225073858507201383090232717332404064219215980462331830553327416887204434813918195854283159012511020564067339731035811005152434161553460108856012385377718821130777993532002330479610147442583636071921565046942503734208375250806650616658158948720491179968591639648500635908770118304874799780887753749949451580451605050915399856582470818645113537935804992115981085766051992433352114352390148795699609591288891602992641511063466313393663477586513029371762047325631781485664350872122828637642044846811407613911477062801689853244110024161447421618567166150540154285084716752901903161322778896729707373123334086988983175067838846926092773977972858659654941091369095406136467568702398678315290680984617210924625396728515625e-308")
+      end
     end
   end
 

Added: MacRuby/branches/experimental/spec/frozen/core/hash/constructor_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/constructor_spec.rb	                        (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/constructor_spec.rb	2009-04-04 15:24:45 UTC (rev 1343)
@@ -0,0 +1,33 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe "Hash.[]" do
+  it "creates a Hash; values can be provided as the argument list" do
+    Hash[:a, 1, :b, 2].should == {:a => 1, :b => 2}
+    Hash[].should == {}
+    Hash[:a, 1, :b, {:c => 2}].should == {:a => 1, :b => {:c => 2}}
+  end
+
+  it "creates a Hash; values can be provided as one single hash" do
+    Hash[:a => 1, :b => 2].should == {:a => 1, :b => 2}
+    Hash[{1 => 2, 3 => 4}].should == {1 => 2, 3 => 4}
+    Hash[{}].should == {}
+  end
+
+  it "raises an ArgumentError when passed an odd number of arguments" do
+    lambda { Hash[1, 2, 3] }.should raise_error(ArgumentError)
+    lambda { Hash[1, 2, {3 => 4}] }.should raise_error(ArgumentError)
+  end
+
+  ruby_bug "#", "1.8.6" do
+    it "call to_hash" do
+      obj = mock('x')
+      def obj.to_hash() { 1 => 2, 3 => 4 } end
+      Hash[obj].should == { 1 => 2, 3 => 4 }
+    end
+  end
+
+  it "returns an instance of the class it's called on" do
+    Hash[MyHash[1, 2]].class.should == Hash
+    MyHash[Hash[1, 2]].class.should == MyHash
+  end
+end

Modified: MacRuby/branches/experimental/spec/frozen/language/super_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/super_spec.rb	2009-04-04 15:24:30 UTC (rev 1342)
+++ MacRuby/branches/experimental/spec/frozen/language/super_spec.rb	2009-04-04 15:24:45 UTC (rev 1343)
@@ -57,20 +57,22 @@
     Super::S4::B.new.foo([],"test").should == ["B#foo(a,test)", "A#foo"]
   end
 
-  it "raises an error error when super method does not exist" do
-    sup = Class.new
-    sub_normal = Class.new(sup) do
-      def foo
-        super()
+  ruby_bug "#1151 [ruby-core:22040]", "1.8.6" do
+    it "raises an error error when super method does not exist" do
+      sup = Class.new
+      sub_normal = Class.new(sup) do
+        def foo
+          super()
+        end
       end
-    end
-    sub_zsuper = Class.new(sup) do
-      def foo
-        super
+      sub_zsuper = Class.new(sup) do
+        def foo
+          super
+        end
       end
+
+      lambda {sub_normal.new.foo}.should raise_error(NoMethodError, /super/)
+      lambda {sub_zsuper.new.foo}.should raise_error(NoMethodError, /super/)
     end
-
-    lambda {sub_normal.new.foo}.should raise_error(NoMethodError, /super/)
-    lambda {sub_zsuper.new.foo}.should raise_error(NoMethodError, /super/)
   end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090404/46463707/attachment-0001.html>


More information about the macruby-changes mailing list