summaryrefslogtreecommitdiff
path: root/spec/ruby/library/bigdecimal
diff options
context:
space:
mode:
authorBenoit Daloze <[email protected]>2020-03-28 00:22:51 +0100
committerBenoit Daloze <[email protected]>2020-03-28 00:22:51 +0100
commitf234d51eaba861edea925eabb564a0bee41b96a0 (patch)
tree3334f36a91fe81ec704f2980ab169231f52c41d0 /spec/ruby/library/bigdecimal
parent296f68816cf575b3ff920f92aec8a4109a7d81d4 (diff)
Update to ruby/spec@ec84479
Diffstat (limited to 'spec/ruby/library/bigdecimal')
-rw-r--r--spec/ruby/library/bigdecimal/BigDecimal_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
index 0c07e46f59..faa8dc610c 100644
--- a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
+++ b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb
@@ -175,6 +175,22 @@ describe "Kernel#BigDecimal" do
BigDecimal(3).add(1 << 50, 3).should == BigDecimal('0.113e16')
end
+ it "does not call to_s when calling inspect" do
+ value = BigDecimal('44.44')
+ value.to_s.should == '0.4444e2'
+ value.inspect.should == '0.4444e2'
+
+ ruby_exe( <<-'EOF').should == "cheese 0.4444e2"
+ require 'bigdecimal'
+ module BigDecimalOverride
+ def to_s; "cheese"; end
+ end
+ BigDecimal.prepend BigDecimalOverride
+ value = BigDecimal('44.44')
+ print "#{value.to_s} #{value.inspect}"
+ EOF
+ end
+
describe "when interacting with Rational" do
before :each do
@a = BigDecimal('166.666666666')