test/ruby/test_thread.rb: use safe navigation operator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2d5b57d63c
commit
16f886328a
@ -226,9 +226,9 @@ class TestThread < Test::Unit::TestCase
|
|||||||
assert_equal(t1, t3.value)
|
assert_equal(t1, t3.value)
|
||||||
|
|
||||||
ensure
|
ensure
|
||||||
t1.kill if t1
|
t1&.kill
|
||||||
t2.kill if t2
|
t2&.kill
|
||||||
t3.kill if t3
|
t3&.kill
|
||||||
end
|
end
|
||||||
|
|
||||||
{ 'FIXNUM_MAX' => RbConfig::LIMITS['FIXNUM_MAX'],
|
{ 'FIXNUM_MAX' => RbConfig::LIMITS['FIXNUM_MAX'],
|
||||||
@ -629,7 +629,8 @@ class TestThread < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
Thread.pass until t.stop?
|
Thread.pass until t.stop?
|
||||||
assert_predicate(t, :alive?)
|
assert_predicate(t, :alive?)
|
||||||
t.kill
|
ensure
|
||||||
|
t&.kill
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_mutex_deadlock
|
def test_mutex_deadlock
|
||||||
@ -1111,7 +1112,7 @@ q.pop
|
|||||||
Thread.pass until mutex.locked?
|
Thread.pass until mutex.locked?
|
||||||
assert_equal(mutex.owned?, false)
|
assert_equal(mutex.owned?, false)
|
||||||
ensure
|
ensure
|
||||||
th.kill if th
|
th&.kill
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user