Use nested `assert`
MODIFY
mrbgems/mruby-bin-mruby/bintest/mruby.rb
mrbgems/mruby-bin-mruby/bintest/mruby.rb
@@ -3,10 +3,12 @@ require 'open3'
def assert_mruby(exp_out, exp_err, exp_success, args)
out, err, stat = Open3.capture3(cmd("mruby"), *args)
+ assert do
assert_operator(exp_out, :===, out, "standard output")
assert_operator(exp_err, :===, err, "standard error")
assert_equal(exp_success, stat.success?, "exit success?")
end
+end
assert('regression for #1564') do
assert_mruby("", /\A-e:1:2: syntax error, .*\n\z/, false, %w[-e <<])

MODIFY
mrbgems/mruby-complex/test/complex.rb
mrbgems/mruby-complex/test/complex.rb
def assert_complex(real, exp)
+ assert do
assert_float real.real, exp.real
assert_float real.imaginary, exp.imaginary
end
+end
assert 'Complex' do
c = 123i

MODIFY
mrbgems/mruby-io/test/io.rb
mrbgems/mruby-io/test/io.rb
@@ -5,6 +5,7 @@ MRubyIOTestUtil.io_test_setup
$cr, $crlf, $cmd = MRubyIOTestUtil.win? ? [1, "\r\n", "cmd /c "] : [0, "\n", ""]
def assert_io_open(meth)
+ assert do
fd = IO.sysopen($mrbtest_io_rfname)
assert_equal Fixnum, fd.class
io1 = IO.__send__(meth, fd)
@@ -24,6 +25,7 @@ def assert_io_open(meth)
end
io2.close unless meth == :open
end
+end
assert('IO.class', '15.2.20') do
assert_equal(Class, IO.class)

MODIFY
mrbgems/mruby-pack/test/pack.rb
mrbgems/mruby-pack/test/pack.rb
@@ -2,9 +2,11 @@ PACK_IS_LITTLE_ENDIAN = "\x01\00".unpack('S')[0] == 0x01
def assert_pack tmpl, packed, unpacked
t = tmpl.inspect
+ assert do
assert_equal packed, unpacked.pack(tmpl), "#{unpacked.inspect}.pack(#{t})"
assert_equal unpacked, packed.unpack(tmpl), "#{packed.inspect}.unpack(#{t})"
end
+end
# pack & unpack 'm' (base64)
assert('[""].pack("m")') do

MODIFY
mrbgems/mruby-rational/test/rational.rb
mrbgems/mruby-rational/test/rational.rb
@@ -23,11 +23,14 @@ class ComplexLikeNumeric < UserDefinedNumeric
end
def assert_rational(exp, real)
+ assert do
assert_float exp.numerator, real.numerator
assert_float exp.denominator, real.denominator
end
+end
def assert_equal_rational(exp, o1, o2)
+ assert do
if exp
assert_operator(o1, :==, o2)
assert_not_operator(o1, :!=, o2)
@@ -36,6 +39,7 @@ def assert_equal_rational(exp, o1, o2)
assert_operator(o1, :!=, o2)
end
end
+end
def assert_cmp(exp, o1, o2)
if exp == (o1 <=> o2)

Use nested `assert`