diff options
author | shirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-17 02:46:13 +0000 |
---|---|---|
committer | shirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-17 02:46:13 +0000 |
commit | 262cb379d6d2fa6500faa90cfdfa54ae044d2296 (patch) | |
tree | 69fa002830f497af50f4e48b9175a31e0d9a4883 /test/-ext-/st/test_update.rb | |
parent | 697bdb0d7e0db2148120ebc3776ac7046f27d1ef (diff) | |
download | ruby-262cb379d6d2fa6500faa90cfdfa54ae044d2296.tar.gz |
st_update passes the key in st_table
* st.c (st_update): pass the key in st_table so that we can free
memory of the key in st_table when deleting.
[ruby-core:49220] [Bug #7330]
* test/-ext-/st/test_update.rb
(Bug::StTable#test_pass_objects_in_st_table): add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/st/test_update.rb')
-rw-r--r-- | test/-ext-/st/test_update.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/-ext-/st/test_update.rb b/test/-ext-/st/test_update.rb index 68625af428..1b41d2bc03 100644 --- a/test/-ext-/st/test_update.rb +++ b/test/-ext-/st/test_update.rb @@ -34,5 +34,17 @@ class Bug::StTable assert_equal({a: 3, b: 2}, @tbl, :a) assert_equal([:a, 1], args) end + + def test_pass_objects_in_st_table + bug7330 = '[ruby-core:49220]' + key = "abc".freeze + value = "def" + @tbl[key] = value + @tbl.st_update("abc") {|*args| + assert_same(key, args[0], bug7330) + assert_same(value, args[1], bug7330) + nil + } + end end end |