summaryrefslogtreecommitdiff
path: root/test/bigdecimal/test_bigdecimal.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-10-08 15:23:46 -0700
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-07-06 01:15:46 +0900
commitd36b197d7c1ce5684fb215697dc2d404cbd730d0 (patch)
tree2a93f1ceadf02eb62ff1bf346e0b1a6bed820e82 /test/bigdecimal/test_bigdecimal.rb
parentf00efef30ad6eca30e5674493dacbd25b425a4eb (diff)
[ruby/bigdecimal] Remove definition of BigDecimal#initialize_copy
This leaves the default definition, which will raise FrozenError. https://github.com/ruby/bigdecimal/commit/05e843d838
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3295
Diffstat (limited to 'test/bigdecimal/test_bigdecimal.rb')
-rw-r--r--test/bigdecimal/test_bigdecimal.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index 80ef39a..874338b 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -1884,10 +1884,12 @@ class TestBigDecimal < Test::Unit::TestCase
EOS
end
- def test_no_initialize_copy
- assert_equal(false, BigDecimal(1).respond_to?(:initialize_copy, true))
- assert_equal(false, BigDecimal(1).respond_to?(:initialize_dup, true))
- assert_equal(false, BigDecimal(1).respond_to?(:initialize_clone, true))
+ def test_initialize_copy_dup_clone_frozen_error
+ bd = BigDecimal(1)
+ bd2 = BigDecimal(2)
+ assert_raise(FrozenError) { bd.send(:initialize_copy, bd2) }
+ assert_raise(FrozenError) { bd.send(:initialize_clone, bd2) }
+ assert_raise(FrozenError) { bd.send(:initialize_dup, bd2) }
end
def assert_no_memory_leak(code, *rest, **opt)