|
48 | 48 | (-1).send(@method, 4611686018427387905).should eql(-1) |
49 | 49 | end |
50 | 50 |
|
51 | | - it "returns Float::INFINITY when the number is too big" do |
52 | | - -> { |
53 | | - 2.send(@method, 427387904).should == Float::INFINITY |
54 | | - }.should complain(/warning: in a\*\*b, b may be too big/) |
| 51 | + ruby_version_is ""..."3.4" do |
| 52 | + it "returns Float::INFINITY when the number is too big" do |
| 53 | + -> { |
| 54 | + 2.send(@method, 427387904).should == Float::INFINITY |
| 55 | + }.should complain(/warning: in a\*\*b, b may be too big/) |
| 56 | + end |
| 57 | + end |
| 58 | + |
| 59 | + ruby_version_is "3.4" do |
| 60 | + it "raises an ArgumentError when the number is too big" do |
| 61 | + -> { 100000000.send(@method, 1000000000) }.should raise_error(ArgumentError) |
| 62 | + end |
55 | 63 | end |
56 | 64 |
|
57 | 65 | it "raises a ZeroDivisionError for 0 ** -1" do |
|
108 | 116 | -> { @bignum.send(@method, :symbol) }.should raise_error(TypeError) |
109 | 117 | end |
110 | 118 |
|
111 | | - it "switch to a Float when the values is too big" do |
112 | | - flt = nil |
113 | | - -> { |
114 | | - flt = @bignum.send(@method, @bignum) |
115 | | - }.should complain(/warning: in a\*\*b, b may be too big/) |
116 | | - flt.should be_kind_of(Float) |
117 | | - flt.infinite?.should == 1 |
| 119 | + ruby_version_is ""..."3.4" do |
| 120 | + it "switch to a Float when the values is too big" do |
| 121 | + flt = nil |
| 122 | + -> { |
| 123 | + flt = @bignum.send(@method, @bignum) |
| 124 | + }.should complain(/warning: in a\*\*b, b may be too big/) |
| 125 | + flt.should be_kind_of(Float) |
| 126 | + flt.infinite?.should == 1 |
| 127 | + end |
| 128 | + end |
| 129 | + |
| 130 | + ruby_version_is "3.4" do |
| 131 | + it "does not switch to a Float when the values is too big" do |
| 132 | + -> { |
| 133 | + @bignum.send(@method, @bignum) |
| 134 | + }.should raise_error(ArgumentError) |
| 135 | + end |
118 | 136 | end |
119 | 137 |
|
120 | 138 | it "returns a complex number when negative and raised to a fractional power" do |
|
0 commit comments