ruby-changes:67971
From: Hiroshi <ko1@a...>
Date: Mon, 13 Sep 2021 21:07:06 +0900 (JST)
Subject: [ruby-changes:67971] be04006c7d (master): Rename capture_io to capture_output and deprecate to use capture_io
https://git.ruby-lang.org/ruby.git/commit/?id=be04006c7d From be04006c7d2f9aeb7e9d8d09d945b3a9c7850202 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Mon, 13 Sep 2021 20:56:34 +0900 Subject: Rename capture_io to capture_output and deprecate to use capture_io --- tool/lib/test/unit/assertions.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tool/lib/test/unit/assertions.rb b/tool/lib/test/unit/assertions.rb index 814dd44..ecbcf74 100644 --- a/tool/lib/test/unit/assertions.rb +++ b/tool/lib/test/unit/assertions.rb @@ -312,19 +312,15 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/assertions.rb#L312 ## # Captures $stdout and $stderr into strings: # - # out, err = capture_io do + # out, err = capture_output do # puts "Some info" # warn "You did a bad thing" # end # # assert_match %r%info%, out # assert_match %r%bad%, err - # - # NOTE: For efficiency, this method uses StringIO and does not - # capture IO for subprocesses. Use #capture_subprocess_io for - # that. - def capture_io + def capture_output require 'stringio' captured_stdout, captured_stderr = StringIO.new, StringIO.new @@ -343,7 +339,10 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/assertions.rb#L339 return captured_stdout.string, captured_stderr.string end - alias capture_output capture_io + + def capture_io + raise NoMethodError, "use capture_output" + end ## # Returns details for exception +e+ -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/