diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-01-22 11:40:37 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-26 17:28:50 +0900 |
| commit | 1507118f0b70fc8002b4b0f186b464c64965cd1e (patch) | |
| tree | f6675bc00514e1a3793e506d581aaafe10e9d42e /test/ruby | |
| parent | 7d159a87873d72027a8230d9cb63698d1f3c5cac (diff) | |
[Feature #19362] Call `#initialize_dup` hook at `Proc#dup`
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_proc.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 4245a7b785..8d6ebf5dcb 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -388,6 +388,15 @@ class TestProc < Test::Unit::TestCase def test_dup_subclass c1 = Class.new(Proc) assert_equal c1, c1.new{}.dup.class, '[Bug #17545]' + c1 = Class.new(Proc) {def initialize_dup(*) throw :initialize_dup; end} + assert_throw(:initialize_dup) {c1.new{}.dup} + end + + def test_clone_subclass + c1 = Class.new(Proc) + assert_equal c1, c1.new{}.clone.class, '[Bug #17545]' + c1 = Class.new(Proc) {def initialize_clone(*) throw :initialize_clone; end} + assert_throw(:initialize_clone) {c1.new{}.clone} end def test_binding |
