mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 20:44:20 +00:00
Fix flaky TestWeakMap#test_inspect_garbage
If a GC is ran before the assert_match, then the WeakMap would be empty and would not have any objects, so the regular expression match would fail. This changes the regular expression to work even if the WeakMap is empty.
This commit is contained in:
parent
b8a592fe6e
commit
eb215c8dc6
@ -78,7 +78,7 @@ class TestWeakMap < Test::Unit::TestCase
|
||||
@wm[i] = Object.new
|
||||
@wm.inspect
|
||||
end
|
||||
assert_match(/\A\#<#{@wm.class.name}:[^:]++:(?:\s\d+\s=>\s\#<(?:Object|collected):[^:<>]*+>(?:,|>\z))+/,
|
||||
assert_match(/\A\#<#{@wm.class.name}:0x[\da-f]+(?::(?: \d+ => \#<(?:Object|collected):0x[\da-f]+>,?)+)?>\z/,
|
||||
@wm.inspect)
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user