ruby-changes:56869
From: Hiroshi <ko1@a...>
Date: Thu, 8 Aug 2019 17:21:03 +0900 (JST)
Subject: [ruby-changes:56869] Hiroshi SHIBATA: b39efb163d (master): Aliases capture_output to capture_io for test-unit compatiblity.
https://git.ruby-lang.org/ruby.git/commit/?id=b39efb163d From b39efb163dd97a6b2c92cac3d2b1c19f898d0c04 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Thu, 8 Aug 2019 17:19:23 +0900 Subject: Aliases capture_output to capture_io for test-unit compatiblity. 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 https://github.com/ruby/ruby/blob/trunk/test/benchmark/test_benchmark.rb#L34 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 https://github.com/ruby/ruby/blob/trunk/test/benchmark/test_benchmark.rb#L81 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 https://github.com/ruby/ruby/blob/trunk/test/csv/interface/test_read.rb#L104 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 https://github.com/ruby/ruby/blob/trunk/test/irb/test_context.rb#L68 "_\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 https://github.com/ruby/ruby/blob/trunk/test/webrick/utils.rb#L45 :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 https://github.com/ruby/ruby/blob/trunk/tool/lib/minitest/unit.rb#L480 return captured_stdout.string, captured_stderr.string end + alias capture_output capture_io ## # Captures $stdout and $stderr into strings, using Tempfile to -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/