diff options
Diffstat (limited to 'spec/ruby/shared')
-rw-r--r-- | spec/ruby/shared/kernel/object_id.rb | 8 | ||||
-rw-r--r-- | spec/ruby/shared/rational/exponent.rb | 18 | ||||
-rw-r--r-- | spec/ruby/shared/string/times.rb | 2 |
3 files changed, 18 insertions, 10 deletions
diff --git a/spec/ruby/shared/kernel/object_id.rb b/spec/ruby/shared/kernel/object_id.rb index 175f3fb749..7acdb27554 100644 --- a/spec/ruby/shared/kernel/object_id.rb +++ b/spec/ruby/shared/kernel/object_id.rb @@ -16,7 +16,7 @@ describe :object_id, shared: true do o1.__send__(@method).should_not == o2.__send__(@method) end - it "returns the same value for two Integers with the same value" do + it "returns the same value for two Fixnums with the same value" do o1 = 1 o2 = 1 o1.send(@method).should == o2.send(@method) @@ -46,7 +46,7 @@ describe :object_id, shared: true do o1.send(@method).should == o2.send(@method) end - it "returns a different value for two Integer literals" do + it "returns a different value for two Bignum literals" do o1 = 2e100.to_i o2 = 2e100.to_i o1.send(@method).should_not == o2.send(@method) @@ -64,14 +64,14 @@ describe :object_id, shared: true do o1.send(@method).should_not == o2.send(@method) end - it "returns a different value for two numbers near the 32 bit Integer limit" do + it "returns a different value for two numbers near the 32 bit Fixnum limit" do o1 = -1 o2 = 2 ** 30 - 1 o1.send(@method).should_not == o2.send(@method) end - it "returns a different value for two numbers near the 64 bit Integer limit" do + it "returns a different value for two numbers near the 64 bit Fixnum limit" do o1 = -1 o2 = 2 ** 62 - 1 diff --git a/spec/ruby/shared/rational/exponent.rb b/spec/ruby/shared/rational/exponent.rb index 0f6abcd634..4ef83ee806 100644 --- a/spec/ruby/shared/rational/exponent.rb +++ b/spec/ruby/shared/rational/exponent.rb @@ -59,7 +59,7 @@ describe :rational_exponent, shared: true do end end - describe "when passed Integer" do + describe "when passed Bignum" do # #5713 it "returns Rational(0) when self is Rational(0) and the exponent is positive" do (Rational(0) ** bignum_value).should eql(Rational(0)) @@ -85,13 +85,21 @@ describe :rational_exponent, shared: true do end it "returns positive Infinity when self is > 1" do - (Rational(2) ** bignum_value).infinite?.should == 1 - (Rational(fixnum_max) ** bignum_value).infinite?.should == 1 + -> { + (Rational(2) ** bignum_value).infinite?.should == 1 + }.should complain(/warning: in a\*\*b, b may be too big/) + -> { + (Rational(fixnum_max) ** bignum_value).infinite?.should == 1 + }.should complain(/warning: in a\*\*b, b may be too big/) end it "returns 0.0 when self is > 1 and the exponent is negative" do - (Rational(2) ** -bignum_value).should eql(0.0) - (Rational(fixnum_max) ** -bignum_value).should eql(0.0) + -> { + (Rational(2) ** -bignum_value).should eql(0.0) + }.should complain(/warning: in a\*\*b, b may be too big/) + -> { + (Rational(fixnum_max) ** -bignum_value).should eql(0.0) + }.should complain(/warning: in a\*\*b, b may be too big/) end # Fails on linux due to pow() bugs in glibc: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866 diff --git a/spec/ruby/shared/string/times.rb b/spec/ruby/shared/string/times.rb index fcc9d00fd6..cd4edf5340 100644 --- a/spec/ruby/shared/string/times.rb +++ b/spec/ruby/shared/string/times.rb @@ -23,7 +23,7 @@ describe :string_times, shared: true do -> { @object.call("cool", min_long) }.should raise_error(ArgumentError) end - it "raises a RangeError when given integer is an Integer" do + it "raises a RangeError when given integer is a Bignum" do -> { @object.call("cool", 999999999999999999999) }.should raise_error(RangeError) -> { @object.call("", 999999999999999999999) }.should raise_error(RangeError) end |