diff options
-rw-r--r-- | st.c | 1 | ||||
-rw-r--r-- | test/ruby/test_hash.rb | 13 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 14 insertions, 2 deletions
@@ -1356,7 +1356,6 @@ st_shift(st_table *tab, st_data_t *key, st_data_t *value) return 1; } } - tab->entries_start = tab->entries_bound = 0; if (value != 0) *value = 0; return 0; } diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index aaf92d4f06..d217776a2c 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1011,6 +1011,19 @@ class TestHash < Test::Unit::TestCase assert_equal("FOO", h.shift) end + def test_shift_for_empty_hash + # [ruby-dev:51159] + h = @cls[] + 100.times{|n| + while h.size < n + k = Random.rand 0..1<<30 + h[k] = 1 + end + 0 while h.shift + assert_equal({}, h) + } + end + def test_reject_bang2 assert_equal({1=>2}, @cls[1=>2,3=>4].reject! {|k, v| k + v == 7 }) assert_nil(@cls[1=>2,3=>4].reject! {|k, v| k == 5 }) @@ -12,7 +12,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 4 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 196 +#define RUBY_PATCHLEVEL 197 #define RUBY_RELEASE_YEAR 2022 #define RUBY_RELEASE_MONTH 3 |