diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-09-13 20:56:34 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-09-13 20:56:34 +0900 |
commit | be04006c7d2f9aeb7e9d8d09d945b3a9c7850202 (patch) | |
tree | b0f556e1351528ccf420d151b4860ddbf0bd202a /tool/lib | |
parent | 455978cd133f27fab9e2bfa4301efd3b7c7d0462 (diff) | |
download | ruby-be04006c7d2f9aeb7e9d8d09d945b3a9c7850202.tar.gz |
Rename capture_io to capture_output and deprecate to use capture_io
Diffstat (limited to 'tool/lib')
-rw-r--r-- | tool/lib/test/unit/assertions.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tool/lib/test/unit/assertions.rb b/tool/lib/test/unit/assertions.rb index 814dd4497e..ecbcf7476e 100644 --- a/tool/lib/test/unit/assertions.rb +++ b/tool/lib/test/unit/assertions.rb @@ -312,19 +312,15 @@ module Test ## # 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 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+ |