summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-io
diff options
context:
space:
mode:
authordearblue <[email protected]>2019-06-28 23:13:29 +0900
committerdearblue <[email protected]>2019-06-29 11:54:17 +0900
commita215292b6ad4315a5a0edef49a1df65e3f27b46a (patch)
tree1e184fe681548c4cb016e279c4af23b51388cb03 /mrbgems/mruby-io
parent1b9f949f3662ffaf39145638e15d628e0e94661e (diff)
downloadmruby-a215292b6ad4315a5a0edef49a1df65e3f27b46a.tar.gz
mruby-a215292b6ad4315a5a0edef49a1df65e3f27b46a.zip
Use nested `assert`
Diffstat (limited to 'mrbgems/mruby-io')
-rw-r--r--mrbgems/mruby-io/test/io.rb32
1 files changed, 17 insertions, 15 deletions
diff --git a/mrbgems/mruby-io/test/io.rb b/mrbgems/mruby-io/test/io.rb
index ef0b49643..1491a4cfe 100644
--- a/mrbgems/mruby-io/test/io.rb
+++ b/mrbgems/mruby-io/test/io.rb
@@ -5,24 +5,26 @@ MRubyIOTestUtil.io_test_setup
$cr, $crlf, $cmd = MRubyIOTestUtil.win? ? [1, "\r\n", "cmd /c "] : [0, "\n", ""]
def assert_io_open(meth)
- fd = IO.sysopen($mrbtest_io_rfname)
- assert_equal Fixnum, fd.class
- io1 = IO.__send__(meth, fd)
- begin
- assert_equal IO, io1.class
- assert_equal $mrbtest_io_msg, io1.read
- ensure
- io1.close
- end
+ assert do
+ fd = IO.sysopen($mrbtest_io_rfname)
+ assert_equal Fixnum, fd.class
+ io1 = IO.__send__(meth, fd)
+ begin
+ assert_equal IO, io1.class
+ assert_equal $mrbtest_io_msg, io1.read
+ ensure
+ io1.close
+ end
- io2 = IO.__send__(meth, IO.sysopen($mrbtest_io_rfname))do |io|
- if meth == :open
- assert_equal $mrbtest_io_msg, io.read
- else
- flunk "IO.#{meth} does not take block"
+ io2 = IO.__send__(meth, IO.sysopen($mrbtest_io_rfname))do |io|
+ if meth == :open
+ assert_equal $mrbtest_io_msg, io.read
+ else
+ flunk "IO.#{meth} does not take block"
+ end
end
+ io2.close unless meth == :open
end
- io2.close unless meth == :open
end
assert('IO.class', '15.2.20') do