diff options
| author | Jeremy Evans <code@jeremyevans.net> | 2021-12-27 14:41:43 -0800 |
|---|---|---|
| committer | Jeremy Evans <code@jeremyevans.net> | 2022-01-14 12:17:57 -0800 |
| commit | a93cc3e23b4044762e80820fc7a45606587e11db (patch) | |
| tree | be06c72142c01f40013a6f58bc334a4f907bea88 /test/ruby | |
| parent | 6b7eff90860d4fb4db01ec4d1f522afa6d809632 (diff) | |
Make Hash#shift return nil for empty hash
Fixes [Bug #16908]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5360
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_hash.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index f79879c20a..39376524fa 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1048,14 +1048,14 @@ class TestHash < Test::Unit::TestCase h = @cls.new {|hh, k| :foo } h[1] = 2 assert_equal([1, 2], h.shift) - assert_equal(:foo, h.shift) - assert_equal(:foo, h.shift) + assert_nil(h.shift) + assert_nil(h.shift) h = @cls.new(:foo) h[1] = 2 assert_equal([1, 2], h.shift) - assert_equal(:foo, h.shift) - assert_equal(:foo, h.shift) + assert_nil(h.shift) + assert_nil(h.shift) h =@cls[1=>2] h.each { assert_equal([1, 2], h.shift) } @@ -1066,7 +1066,7 @@ class TestHash < Test::Unit::TestCase def h.default(k = nil) super.upcase end - assert_equal("FOO", h.shift) + assert_nil(h.shift) end def test_reject_bang2 |
