check SystemStackError
This recursive iteration test can cause SystemStackError so check it correctly.
This commit is contained in:
parent
cac44def0b
commit
5f95edb7af
@ -1729,20 +1729,24 @@ class TestHash < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_huge_iter_level
|
||||
h = @cls[a: 1]
|
||||
assert_raise(RuntimeError){
|
||||
hrec(h, 1000){ h[:c] = 3 }
|
||||
}
|
||||
nrec = 200
|
||||
|
||||
h = @cls[a: 1]
|
||||
hrec(h, 1000){}
|
||||
hrec(h, nrec){}
|
||||
h[:c] = 3
|
||||
assert_equal(3, h[:c])
|
||||
|
||||
h = @cls[a: 1]
|
||||
h.freeze # set hidden attribute for a frozen object
|
||||
hrec(h, 1000){}
|
||||
hrec(h, nrec){}
|
||||
assert_equal(1, h.size)
|
||||
|
||||
h = @cls[a: 1]
|
||||
assert_raise(RuntimeError){
|
||||
hrec(h, nrec){ h[:c] = 3 }
|
||||
}
|
||||
rescue SystemStackError => e
|
||||
# ignore
|
||||
end
|
||||
|
||||
class TestSubHash < TestHash
|
||||
|
Loading…
x
Reference in New Issue
Block a user