ruby-changes:64638
From: Nobuyoshi <ko1@a...>
Date: Mon, 28 Dec 2020 12:13:18 +0900 (JST)
Subject: [ruby-changes:64638] 64d79d333b (master): Suppress too big exponent warnings
https://git.ruby-lang.org/ruby.git/commit/?id=64d79d333b From 64d79d333baf49f1adab9f9015ee02603ed89210 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 28 Dec 2020 12:12:54 +0900 Subject: Suppress too big exponent warnings diff --git a/spec/ruby/shared/rational/exponent.rb b/spec/ruby/shared/rational/exponent.rb index 4ef83ee..3fd02de 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/shared/rational/exponent.rb#L105 # 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/