mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Aliases capture_output to capture_io for test-unit compatiblity.
This commit is contained in:
parent
1ad0f4e593
commit
b39efb163d
5 changed files with 6 additions and 9 deletions
|
@ -34,12 +34,8 @@ class TestBenchmark < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def capture_output
|
||||
capture_io { yield }.first.gsub(/[ \-]\d\.\d{6}/, ' --time--')
|
||||
end
|
||||
|
||||
def capture_bench_output(type, *args, &block)
|
||||
capture_output { bench(type, *args, &block) }
|
||||
capture_output { bench(type, *args, &block) }.first.gsub(/[ \-]\d\.\d{6}/, ' --time--')
|
||||
end
|
||||
|
||||
def test_tms_outputs_nicely
|
||||
|
@ -85,7 +81,7 @@ BENCH
|
|||
|
||||
def test_bm_returns_an_Array_of_the_times_with_the_labels
|
||||
[:bm, :bmbm].each do |meth|
|
||||
capture_io do
|
||||
capture_output do
|
||||
results = bench(meth)
|
||||
assert_instance_of(Array, results)
|
||||
assert_equal(labels.size, results.size)
|
||||
|
|
|
@ -104,7 +104,7 @@ class TestCSVInterfaceRead < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_open_encoding_nonexistent
|
||||
_output, error = capture_io do
|
||||
_output, error = capture_output do
|
||||
CSV.open(@input.path, encoding: "nonexistent") do
|
||||
end
|
||||
end
|
||||
|
|
|
@ -68,7 +68,7 @@ module TestIRB
|
|||
"_\n",
|
||||
])
|
||||
irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input)
|
||||
out, err = capture_io do
|
||||
out, err = capture_output do
|
||||
irb.eval_input
|
||||
end
|
||||
assert_empty err
|
||||
|
|
|
@ -45,7 +45,7 @@ module TestWEBrick
|
|||
:Logger => WEBrick::Log.new(log_ary, WEBrick::BasicLog::WARN),
|
||||
:AccessLog => [[access_log_ary, ""]]
|
||||
}.update(config))
|
||||
server = capture_io {break klass.new(config)}
|
||||
server = capture_output {break klass.new(config)}
|
||||
server_thread = server.start
|
||||
server_thread2 = Thread.new {
|
||||
server_thread.join
|
||||
|
|
|
@ -480,6 +480,7 @@ module MiniTest
|
|||
|
||||
return captured_stdout.string, captured_stderr.string
|
||||
end
|
||||
alias capture_output capture_io
|
||||
|
||||
##
|
||||
# Captures $stdout and $stderr into strings, using Tempfile to
|
||||
|
|
Loading…
Add table
Reference in a new issue