diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-28 12:12:54 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-28 12:12:54 +0900 |
commit | 64d79d333baf49f1adab9f9015ee02603ed89210 (patch) | |
tree | db0c1fd05692d729cb006b863f186ec8691d952e /spec/ruby/shared/rational | |
parent | 228ad7d84b0f097a1465541fd175887c5ec0db40 (diff) | |
download | ruby-64d79d333baf49f1adab9f9015ee02603ed89210.tar.gz |
Suppress too big exponent warnings
Diffstat (limited to 'spec/ruby/shared/rational')
-rw-r--r-- | spec/ruby/shared/rational/exponent.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/spec/ruby/shared/rational/exponent.rb b/spec/ruby/shared/rational/exponent.rb index 4ef83ee806..3fd02de08f 100644 --- a/spec/ruby/shared/rational/exponent.rb +++ b/spec/ruby/shared/rational/exponent.rb @@ -105,14 +105,24 @@ describe :rational_exponent, shared: true do # Fails on linux due to pow() bugs in glibc: http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866 platform_is_not :linux do it "returns positive Infinity when self < -1" do - (Rational(-2) ** bignum_value).infinite?.should == 1 - (Rational(-2) ** (bignum_value + 1)).infinite?.should == 1 - (Rational(fixnum_min) ** bignum_value).infinite?.should == 1 + -> { + (Rational(-2) ** bignum_value).infinite?.should == 1 + }.should complain(/warning: in a\*\*b, b may be too big/) + -> { + (Rational(-2) ** (bignum_value + 1)).infinite?.should == 1 + }.should complain(/warning: in a\*\*b, b may be too big/) + -> { + (Rational(fixnum_min) ** 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_min) ** -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_min) ** -bignum_value).should eql(0.0) + }.should complain(/warning: in a\*\*b, b may be too big/) end end end |