summaryrefslogtreecommitdiff
path: root/spec/ruby/library/bigdecimal
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-05-31 18:22:49 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-05-31 18:22:49 +0200
commit34776105c8a6739ca3aad1de4a2c942f4a8f2f29 (patch)
tree0103cf2cc89c1322d8c3e88fff0a80b54db8320b /spec/ruby/library/bigdecimal
parentf4502b001a665109bf776f9037ecbc52cb5f2d88 (diff)
Update to ruby/spec@4e486fa
Diffstat (limited to 'spec/ruby/library/bigdecimal')
-rw-r--r--spec/ruby/library/bigdecimal/BigDecimal_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
index 4e839e21a3..5da0210145 100644
--- a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
+++ b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
@@ -112,6 +112,17 @@ describe "Kernel#BigDecimal" do
neg_inf.should < 0
end
+ ruby_version_is "2.6" do
+ describe "with exception: false" do
+ it "returns nil for invalid strings" do
+ BigDecimal("invalid", exception: false).should be_nil
+ BigDecimal("0invalid", exception: false).should be_nil
+ BigDecimal("invalid0", exception: false).should be_nil
+ BigDecimal("0.", exception: false).should be_nil
+ end
+ end
+ end
+
describe "accepts NaN and [+-]Infinity as Float values" do
it "works without an explicit precision" do
BigDecimal(Float::NAN).should.nan?