diff options
author | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-23 10:59:59 +0000 |
---|---|---|
committer | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-23 10:59:59 +0000 |
commit | 16f886328a03b887a71131a8fc740eb18a42898e (patch) | |
tree | 94b7bb6cdb47dd7afec71ca15f3ce788f72553d2 | |
parent | 2d5b57d63c235ec5bd0814552b20eb00604b5f65 (diff) | |
download | ruby-16f886328a03b887a71131a8fc740eb18a42898e.tar.gz |
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
-rw-r--r-- | test/ruby/test_thread.rb | 11 |
1 files changed, 6 insertions, 5 deletions
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 |