Synchronize the test thread not to die before assertions
This commit is contained in:
parent
3a9ff9457a
commit
babdb158d1
@ -29,13 +29,18 @@ class TestThread < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_inspect
|
def test_inspect
|
||||||
|
m = Thread::Mutex.new
|
||||||
|
m.lock
|
||||||
line = __LINE__+1
|
line = __LINE__+1
|
||||||
th = Module.new {break module_eval("class C\u{30b9 30ec 30c3 30c9} < Thread; self; end")}.start{}
|
th = Module.new {break module_eval("class C\u{30b9 30ec 30c3 30c9} < Thread; self; end")}.start do
|
||||||
|
m.synchronize {}
|
||||||
|
end
|
||||||
s = th.inspect
|
s = th.inspect
|
||||||
assert_include(s, "::C\u{30b9 30ec 30c3 30c9}:")
|
assert_include(s, "::C\u{30b9 30ec 30c3 30c9}:")
|
||||||
assert_include(s, " #{__FILE__}:#{line} ")
|
assert_include(s, " #{__FILE__}:#{line} ")
|
||||||
assert_equal(s, th.to_s)
|
assert_equal(s, th.to_s)
|
||||||
ensure
|
ensure
|
||||||
|
m.unlock
|
||||||
th.join
|
th.join
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user