summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-08 17:19:23 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-08 17:19:23 +0900
commitb39efb163dd97a6b2c92cac3d2b1c19f898d0c04 (patch)
treea713be83c67c47c0f31a3601d640210c34f10fc5
parent1ad0f4e593563d460e3015fc4a2542ce1bb80d6e (diff)
Aliases capture_output to capture_io for test-unit compatiblity.
-rw-r--r--test/benchmark/test_benchmark.rb8
-rw-r--r--test/csv/interface/test_read.rb2
-rw-r--r--test/irb/test_context.rb2
-rw-r--r--test/webrick/utils.rb2
-rw-r--r--tool/lib/minitest/unit.rb1
5 files changed, 6 insertions, 9 deletions
diff --git a/test/benchmark/test_benchmark.rb b/test/benchmark/test_benchmark.rb
index 655c694..0eb331a 100644
--- a/test/benchmark/test_benchmark.rb
+++ b/test/benchmark/test_benchmark.rb
@@ -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)
diff --git a/test/csv/interface/test_read.rb b/test/csv/interface/test_read.rb
index 8fefbbb..5262096 100644
--- a/test/csv/interface/test_read.rb
+++ b/test/csv/interface/test_read.rb
@@ -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
diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb
index 8b245d1..df9edcc 100644
--- a/test/irb/test_context.rb
+++ b/test/irb/test_context.rb
@@ -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
diff --git a/test/webrick/utils.rb b/test/webrick/utils.rb
index cc231f0..ca9c56a 100644
--- a/test/webrick/utils.rb
+++ b/test/webrick/utils.rb
@@ -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
diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb
index a384ddc..bd244d8 100644
--- a/tool/lib/minitest/unit.rb
+++ b/tool/lib/minitest/unit.rb
@@ -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