summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-07 15:07:51 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-07 15:07:51 +0000
commit59c5d0b91084cfc27a98a193621a016ec1183c52 (patch)
treeb9c455b364ed4e9b8357acea112c0c554cf3c7a7 /test/ruby
parent583572370a03cdd09f0a848f2b8186e15fd798a0 (diff)
Use `&.` instead of modifier if and remove needless closed?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 5745198c99..62caadb091 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -49,8 +49,8 @@ class TestIO < Test::Unit::TestCase
end
flunk("timeout") unless wt.join(10) && rt.join(10)
ensure
- w.close unless !w || w.closed?
- r.close unless !r || r.closed?
+ w&.close
+ r&.close
(wt.kill; wt.join) if wt
(rt.kill; rt.join) if rt
raise we if we
@@ -62,8 +62,8 @@ class TestIO < Test::Unit::TestCase
begin
yield r, w
ensure
- r.close unless r.closed?
- w.close unless w.closed?
+ r.close
+ w.close
end
end
@@ -2325,7 +2325,7 @@ End
t
end
ensure
- t.close(true) if t and block_given?
+ t&.close(true) if block_given?
end
def test_reopen_encoding
@@ -3160,7 +3160,7 @@ __END__
f.ioctl(tiocgwinsz, winsize)
}
ensure
- f.close if f
+ f&.close
end
end if /^(?:i.?86|x86_64)-linux/ =~ RUBY_PLATFORM