diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-17 15:14:23 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-17 15:14:23 +0900 |
| commit | c0d63ea09f41560f42c9d1f2605723fe5e6fa01c (patch) | |
| tree | 5e8f50af3ac966634471240a623a06091e6a0dd6 /test | |
| parent | 75ae3d3e23cf7c27d66c1eb14e0d09331aa1d8c7 (diff) | |
| download | mruby-c0d63ea09f41560f42c9d1f2605723fe5e6fa01c.tar.gz mruby-c0d63ea09f41560f42c9d1f2605723fe5e6fa01c.zip | |
hash.c: `Hash#shift` to return `nil` when a hash is empty.
It used to be return the default value if available, but it should
ignore the default value for behavior consistency. CRuby will adopt
this behavior too in the future. [ruby-bugs:16908]
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/hash.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/t/hash.rb b/test/t/hash.rb index a5e51d83b..9bc2668ae 100644 --- a/test/t/hash.rb +++ b/test/t/hash.rb @@ -775,7 +775,7 @@ assert('Hash#shift', '15.2.13.4.24') do assert_equal(0, h.size) h.default = -456 - assert_equal(-456, h.shift) + assert_equal(nil, h.shift) assert_equal(0, h.size) h.freeze @@ -783,8 +783,8 @@ assert('Hash#shift', '15.2.13.4.24') do end h = Hash.new{|h, k| [h, k]} - assert_operator(h.shift, :eql?, [h, nil]) assert_equal(0, h.size) + assert_equal(nil, h.shift) end # Not ISO specified |
