diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2023-11-08 17:34:09 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2023-11-21 15:15:23 +0900 |
commit | 1cf2fa3af50203f261341ff4c250735c9da5767b (patch) | |
tree | c41d009efe0fd60e44e55a9190487c6ee5aba9de /test/ruby/test_hash.rb | |
parent | a787e0d6494443cfd9bd05ac746704079dcfd03f (diff) |
Raise an exception when Hash#compare_by_identity during its iteration
Diffstat (limited to 'test/ruby/test_hash.rb')
-rw-r--r-- | test/ruby/test_hash.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index a01f730904..970d0938bf 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -2272,4 +2272,13 @@ class TestHashOnly < Test::Unit::TestCase end; end end + + def test_compare_by_identity_during_iteration + h = { 1 => 1 } + h.each do + assert_raise(RuntimeError, "compare_by_identity during iteration") do + h.compare_by_identity + end + end + end end |