Use capture_output instead of capture_io

This commit is contained in:
Hiroshi SHIBATA 2021-09-13 21:14:42 +09:00
parent be04006c7d
commit ec6f04c092
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2
4 changed files with 6 additions and 6 deletions

View File

@ -79,7 +79,7 @@ class TestEnumerator < Test::Unit::TestCase
assert_raise(NoMethodError) { enum.each {} } assert_raise(NoMethodError) { enum.each {} }
enum.freeze enum.freeze
assert_raise(ArgumentError) { assert_raise(ArgumentError) {
capture_io do capture_output do
# warning: Enumerator.new without a block is deprecated; use Object#to_enum # warning: Enumerator.new without a block is deprecated; use Object#to_enum
enum.__send__(:initialize, @obj, :foo) enum.__send__(:initialize, @obj, :foo)
end end

View File

@ -764,7 +764,7 @@ EXPECTED
$VERBOSE = true $VERBOSE = true
_, err = capture_io do _, err = capture_output do
assert_equal "\000", [0].pack("*U") assert_equal "\000", [0].pack("*U")
end end
@ -783,7 +783,7 @@ EXPECTED
$VERBOSE = true $VERBOSE = true
_, err = capture_io do _, err = capture_output do
assert_equal [0], "\000".unpack("*U") assert_equal [0], "\000".unpack("*U")
end end

View File

@ -214,7 +214,7 @@ module Test
# See also: #assert_silent # See also: #assert_silent
def assert_output stdout = nil, stderr = nil def assert_output stdout = nil, stderr = nil
out, err = capture_io do out, err = capture_output do
yield yield
end end

View File

@ -1070,11 +1070,11 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
end end
end end
def test_capture_io def test_capture_output
@assertion_count = 0 @assertion_count = 0
non_verbose do non_verbose do
out, err = capture_io do out, err = capture_output do
puts 'hi' puts 'hi'
$stderr.puts 'bye!' $stderr.puts 'bye!'
end end