From 175770bb6c55cb777a5f9318334a64e767a0f9d3 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 27 Dec 2024 16:43:32 +0900 Subject: [PATCH] BigDecimal('0.') with bigdecimal-3.1.9 returns 0.0 --- spec/ruby/library/bigdecimal/BigDecimal_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb index 43a779b420..45f5ebffc7 100644 --- a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb +++ b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb @@ -98,7 +98,11 @@ describe "Kernel#BigDecimal" 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 + if BigDecimal::VERSION >= "3.1.9" + BigDecimal("0.", exception: false).to_i.should == 0 + else + BigDecimal("0.", exception: false).should be_nil + end end end