diff options
author | Benoit Daloze <[email protected]> | 2023-08-02 18:53:03 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2023-08-02 18:53:03 +0200 |
commit | dc54574adefe798702cc93457655da40f4939669 (patch) | |
tree | bd7ae5d6afc9bc00f6cb7813774543bc6f12b6e2 /spec/ruby/library/bigdecimal | |
parent | e20f1e443f6d0a4d377ef237fffc1f4c6e27c9e1 (diff) |
Update to ruby/spec@9e278f5
Diffstat (limited to 'spec/ruby/library/bigdecimal')
-rw-r--r-- | spec/ruby/library/bigdecimal/remainder_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/library/bigdecimal/round_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/library/bigdecimal/to_s_spec.rb | 9 |
3 files changed, 10 insertions, 5 deletions
diff --git a/spec/ruby/library/bigdecimal/remainder_spec.rb b/spec/ruby/library/bigdecimal/remainder_spec.rb index 35e131a0dc..bac5f37ba9 100644 --- a/spec/ruby/library/bigdecimal/remainder_spec.rb +++ b/spec/ruby/library/bigdecimal/remainder_spec.rb @@ -54,7 +54,7 @@ describe "BigDecimal#remainder" do @nan.remainder(@infinity).should.nan? end - version_is BigDecimal::VERSION, ""..."3.1.4" do + version_is BigDecimal::VERSION, ""..."3.1.4" do #ruby_version_is ""..."3.3" do it "returns NaN if Infinity is involved" do @infinity.remainder(@infinity).should.nan? @infinity.remainder(@one).should.nan? diff --git a/spec/ruby/library/bigdecimal/round_spec.rb b/spec/ruby/library/bigdecimal/round_spec.rb index bfc6dbc763..fba52df65d 100644 --- a/spec/ruby/library/bigdecimal/round_spec.rb +++ b/spec/ruby/library/bigdecimal/round_spec.rb @@ -228,13 +228,13 @@ describe "BigDecimal#round" do -> { BigDecimal('-Infinity').round(2) }.should_not raise_error(FloatDomainError) end - ruby_version_is ''...'3.2' do + version_is BigDecimal::VERSION, ''...'3.1.3' do #ruby_version_is ''...'3.2' do it 'raise for a non-existent round mode' do -> { @p1_50.round(0, :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode") end end - ruby_version_is '3.2' do + version_is BigDecimal::VERSION, '3.1.3' do #ruby_version_is '3.2' do it 'raise for a non-existent round mode' do -> { @p1_50.round(0, :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode (nonsense)") end diff --git a/spec/ruby/library/bigdecimal/to_s_spec.rb b/spec/ruby/library/bigdecimal/to_s_spec.rb index 3d03c498fb..63dfaf5e7c 100644 --- a/spec/ruby/library/bigdecimal/to_s_spec.rb +++ b/spec/ruby/library/bigdecimal/to_s_spec.rb @@ -40,14 +40,13 @@ describe "BigDecimal#to_s" do end ruby_version_is ""..."3.3" do - it "inserts a space every n chars, if integer n is supplied" do + it "inserts a space every n chars to fraction part, if integer n is supplied" do re =\ /\A0\.314 159 265 358 979 323 846 264 338 327 950 288 419 716 939 937E1\z/i @bigdec.to_s(3).should =~ re str1 = '-123.45678 90123 45678 9' BigDecimal("-123.45678901234567890").to_s('5F').should == str1 - BigDecimal('1000010').to_s('5F').should == "10000 10.0" # trailing zeroes removed BigDecimal("1.00000000000").to_s('1F').should == "1.0" # 0 is treated as no spaces @@ -55,6 +54,12 @@ describe "BigDecimal#to_s" do end end + version_is BigDecimal::VERSION, "3.1.5" do #ruby_version_is '3.3' do + it "inserts a space every n chars to integer part, if integer n is supplied" do + BigDecimal('1000010').to_s('5F').should == "10 00010.0" + end + end + it "can return a leading space for values > 0" do @bigdec.to_s(" F").should =~ /\ .*/ @bigneg.to_s(" F").should_not =~ /\ .*/ |