diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-04 10:25:42 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-04 10:25:42 +0900 |
commit | d3fd4a6d32d89aaa566732dd7b62bd6065f7449e (patch) | |
tree | b5a36e8c62b80b04457d0aea69e7115f5df3f68e /spec/ruby/library/bigdecimal/to_s_spec.rb | |
parent | ea491802fa4a6ce7070b318ffcad30cbeaf42635 (diff) | |
download | ruby-d3fd4a6d32d89aaa566732dd7b62bd6065f7449e.tar.gz |
BigDecimal#to_s has not changed for fraction part
The test for integer part was separated at dc54574adefe.
Diffstat (limited to 'spec/ruby/library/bigdecimal/to_s_spec.rb')
-rw-r--r-- | spec/ruby/library/bigdecimal/to_s_spec.rb | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/spec/ruby/library/bigdecimal/to_s_spec.rb b/spec/ruby/library/bigdecimal/to_s_spec.rb index 63dfaf5e7c..ba9f960eb3 100644 --- a/spec/ruby/library/bigdecimal/to_s_spec.rb +++ b/spec/ruby/library/bigdecimal/to_s_spec.rb @@ -39,19 +39,17 @@ describe "BigDecimal#to_s" do @bigneg.to_s("+").should_not =~ /^\+.*/ end - ruby_version_is ""..."3.3" 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 - # trailing zeroes removed - BigDecimal("1.00000000000").to_s('1F').should == "1.0" - # 0 is treated as no spaces - BigDecimal("1.2345").to_s('0F').should == "1.2345" - end + 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 + # trailing zeroes removed + BigDecimal("1.00000000000").to_s('1F').should == "1.0" + # 0 is treated as no spaces + BigDecimal("1.2345").to_s('0F').should == "1.2345" end version_is BigDecimal::VERSION, "3.1.5" do #ruby_version_is '3.3' do |