зеркало из https://github.com/github/ruby.git
[ruby/bigdecimal] Remove definition of BigDecimal#initialize_copy
This leaves the default definition, which will raise FrozenError. https://github.com/ruby/bigdecimal/commit/05e843d838
This commit is contained in:
Родитель
f00efef30a
Коммит
d36b197d7c
|
@ -3464,9 +3464,6 @@ Init_bigdecimal(void)
|
|||
|
||||
|
||||
/* instance methods */
|
||||
rb_undef_method(rb_cBigDecimal, "initialize_copy");
|
||||
rb_undef_method(rb_cBigDecimal, "initialize_clone");
|
||||
rb_undef_method(rb_cBigDecimal, "initialize_dup");
|
||||
rb_define_method(rb_cBigDecimal, "precs", BigDecimal_prec, 0);
|
||||
|
||||
rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче