Improved the test for Thread#inspect [Feature #16412]

This commit is contained in:
Nobuyoshi Nakada 2019-12-13 08:52:07 +09:00
parent fa5f7a8f7e
commit b8d6c883b3
No known key found for this signature in database
GPG Key ID: 4BC7D6DF58D8DF60

View File

@ -29,8 +29,12 @@ class TestThread < Test::Unit::TestCase
end
def test_inspect
line = __LINE__+1
th = Module.new {break module_eval("class C\u{30b9 30ec 30c3 30c9} < Thread; self; end")}.start{}
assert_match(/::C\u{30b9 30ec 30c3 30c9}:/, th.inspect)
s = th.inspect
assert_include(s, "::C\u{30b9 30ec 30c3 30c9}:")
assert_include(s, " #{__FILE__}:#{line} ")
assert_equal(s, th.to_s)
ensure
th.join
end