1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-07-27 12:40:09 +02:00
parent a06301b103
commit 5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions

View file

@ -51,16 +51,16 @@ describe "Kernel#BigDecimal" do
ruby_version_is "2.6" do
it "does not ignores trailing garbage" do
lambda { BigDecimal("123E45ruby") }.should raise_error(ArgumentError)
lambda { BigDecimal("123x45") }.should raise_error(ArgumentError)
lambda { BigDecimal("123.4%E5") }.should raise_error(ArgumentError)
lambda { BigDecimal("1E2E3E4E5E") }.should raise_error(ArgumentError)
-> { BigDecimal("123E45ruby") }.should raise_error(ArgumentError)
-> { BigDecimal("123x45") }.should raise_error(ArgumentError)
-> { BigDecimal("123.4%E5") }.should raise_error(ArgumentError)
-> { BigDecimal("1E2E3E4E5E") }.should raise_error(ArgumentError)
end
end
it "raises ArgumentError for invalid strings" do
lambda { BigDecimal("ruby") }.should raise_error(ArgumentError)
lambda { BigDecimal(" \t\n \r-\t\t\tInfinity \n") }.should raise_error(ArgumentError)
-> { BigDecimal("ruby") }.should raise_error(ArgumentError)
-> { BigDecimal(" \t\n \r-\t\t\tInfinity \n") }.should raise_error(ArgumentError)
end
it "allows omitting the integer part" do
@ -82,8 +82,8 @@ describe "Kernel#BigDecimal" do
reference = BigDecimal("12345.67E89")
BigDecimal("12_345.67E89").should == reference
lambda { BigDecimal("1_2_3_4_5_._6____7_E89") }.should raise_error(ArgumentError)
lambda { BigDecimal("12345_.67E_8__9_") }.should raise_error(ArgumentError)
-> { BigDecimal("1_2_3_4_5_._6____7_E89") }.should raise_error(ArgumentError)
-> { BigDecimal("12345_.67E_8__9_") }.should raise_error(ArgumentError)
end
end
@ -151,7 +151,7 @@ describe "Kernel#BigDecimal" do
end
it "raises ArgumentError when Float is used without precision" do
lambda { BigDecimal(1.0) }.should raise_error(ArgumentError)
-> { BigDecimal(1.0) }.should raise_error(ArgumentError)
end
it "returns appropriate BigDecimal zero for signed zero" do