ruby-changes:66163
From: Hiroshi <ko1@a...>
Date: Wed, 12 May 2021 17:25:07 +0900 (JST)
Subject: [ruby-changes:66163] 81d793a921 (master): [rubygems/rubygems] Extract assert_output to assert_empty and assert_equal with capture_output
https://git.ruby-lang.org/ruby.git/commit/?id=81d793a921 From 81d793a9216303f70143b13a88c924c22ce4af6d Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Wed, 18 Mar 2020 17:56:41 +0900 Subject: [rubygems/rubygems] Extract assert_output to assert_empty and assert_equal with capture_output https://github.com/rubygems/rubygems/commit/f6759440a4 --- test/rubygems/test_gem.rb | 4 +++- test/rubygems/test_gem_request_set.rb | 3 ++- test/rubygems/test_gem_specification.rb | 8 ++++++-- test/rubygems/test_gem_version.rb | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 4f99bc8..b3c8a7a 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -1966,9 +1966,11 @@ You may need to `gem install -g` to install missing gems https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1966 EXPECTED Gem::Deprecate.skip_during do - assert_output nil, expected do + actual_stdout, actual_stderr = capture_output do Gem.use_gemdeps end + assert_empty actual_stdout + assert_equal(expected, actual_stderr) end ensure ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb index 54ae772..e2f0bf2 100644 --- a/test/rubygems/test_gem_request_set.rb +++ b/test/rubygems/test_gem_request_set.rb @@ -87,9 +87,10 @@ Gems to install: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set.rb#L87 a-2 EXPECTED - assert_output expected do + actual, _= capture_output do rs.install_from_gemdeps :gemdeps => io.path, :explain => true end + assert_equal(expected, actual) end end diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 42988ad..d4656c0 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -3021,9 +3021,11 @@ WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_specification.rb#L3021 Please report a bug if this causes problems. EXPECTED - assert_output nil, expected do + actual_stdout, actual_stderr = capture_output do specification.reset end + assert_empty actual_stdout + assert_equal(expected, actual_stderr) end def test_unresolved_specs_with_versions @@ -3052,9 +3054,11 @@ WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_specification.rb#L3054 Please report a bug if this causes problems. EXPECTED - assert_output nil, expected do + actual_stdout, actual_stderr = capture_output do specification.reset end + assert_empty actual_stdout + assert_equal(expected, actual_stderr) end def test_duplicate_runtime_dependency diff --git a/test/rubygems/test_gem_version.rb b/test/rubygems/test_gem_version.rb index 7b38280..af37434 100644 --- a/test/rubygems/test_gem_version.rb +++ b/test/rubygems/test_gem_version.rb @@ -47,9 +47,11 @@ class TestGemVersion < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_version.rb#L47 assert_equal false, Gem::Version.correct?("an incorrect version") expected = "nil versions are discouraged and will be deprecated in Rubygems 4\n" - assert_output nil, expected do + actual_stdout, actual_stderr = capture_output do Gem::Version.correct?(nil) end + assert_empty actual_stdout + assert_equal(expected, actual_stderr) end def test_class_new_subclass -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/