1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/-ext-/st/test_numhash.rb
nobu cf1a22fdf9 * st.c (st_update): table can be unpacked in the callback.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07 05:52:15 +00:00

27 lines
534 B
Ruby

require 'test/unit'
require "-test-/st/numhash"
class Bug::StNumHash
class Test_NumHash < Test::Unit::TestCase
def setup
@tbl = Bug::StNumHash.new
5.times {|i| @tbl[i] = i}
end
def test_check
keys = []
@tbl.each do |k, v, t|
keys << k
t[5] = 5 if k == 3
true
end
assert_equal([*0..5], keys)
end
def test_update
assert_equal(true, @tbl.update(0) {@tbl[5] = :x})
assert_equal(:x, @tbl[0])
assert_equal(:x, @tbl[5])
end
end
end