mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 12:34:21 +00:00
Removed unsed assertions for rubygems
This commit is contained in:
parent
d58e0ffc24
commit
8d0315a2bb
@ -356,49 +356,6 @@ module Test
|
||||
end
|
||||
alias capture_output capture_io
|
||||
|
||||
##
|
||||
# Captures $stdout and $stderr into strings, using Tempfile to
|
||||
# ensure that subprocess IO is captured as well.
|
||||
#
|
||||
# out, err = capture_subprocess_io do
|
||||
# system "echo Some info"
|
||||
# system "echo You did a bad thing 1>&2"
|
||||
# end
|
||||
#
|
||||
# assert_match %r%info%, out
|
||||
# assert_match %r%bad%, err
|
||||
#
|
||||
# NOTE: This method is approximately 10x slower than #capture_io so
|
||||
# only use it when you need to test the output of a subprocess.
|
||||
|
||||
def capture_subprocess_io
|
||||
require 'tempfile'
|
||||
|
||||
captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err")
|
||||
|
||||
synchronize do
|
||||
orig_stdout, orig_stderr = $stdout.dup, $stderr.dup
|
||||
$stdout.reopen captured_stdout
|
||||
$stderr.reopen captured_stderr
|
||||
|
||||
begin
|
||||
yield
|
||||
|
||||
$stdout.rewind
|
||||
$stderr.rewind
|
||||
|
||||
[captured_stdout.read, captured_stderr.read]
|
||||
ensure
|
||||
$stdout.reopen orig_stdout
|
||||
$stderr.reopen orig_stderr
|
||||
orig_stdout.close
|
||||
orig_stderr.close
|
||||
captured_stdout.close!
|
||||
captured_stderr.close!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Returns details for exception +e+
|
||||
|
||||
|
||||
@ -1084,20 +1084,6 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_capture_subprocess_io
|
||||
@assertion_count = 0
|
||||
|
||||
non_verbose do
|
||||
out, err = capture_subprocess_io do
|
||||
system("echo", "hi")
|
||||
system("echo", "bye!", out: :err)
|
||||
end
|
||||
|
||||
assert_equal "hi\n", out
|
||||
assert_equal "bye!\n", err
|
||||
end
|
||||
end
|
||||
|
||||
def test_flunk
|
||||
util_assert_triggered 'Epic Fail!' do
|
||||
@tc.flunk
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user