From 16f886328a03b887a71131a8fc740eb18a42898e Mon Sep 17 00:00:00 2001 From: kazu Date: Fri, 23 Nov 2018 10:59:59 +0000 Subject: 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 --- test/ruby/test_thread.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'test/ruby/test_thread.rb') diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index c6716558eb..2b120b4a17 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -226,9 +226,9 @@ class TestThread < Test::Unit::TestCase assert_equal(t1, t3.value) ensure - t1.kill if t1 - t2.kill if t2 - t3.kill if t3 + t1&.kill + t2&.kill + t3&.kill end { 'FIXNUM_MAX' => RbConfig::LIMITS['FIXNUM_MAX'], @@ -629,7 +629,8 @@ class TestThread < Test::Unit::TestCase end Thread.pass until t.stop? assert_predicate(t, :alive?) - t.kill + ensure + t&.kill end def test_mutex_deadlock @@ -1111,7 +1112,7 @@ q.pop Thread.pass until mutex.locked? assert_equal(mutex.owned?, false) ensure - th.kill if th + th&.kill end end -- cgit v1.2.3