diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 54ff3a020..207824678 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -14,7 +14,7 @@ jobs: with: ruby-version: '3.0' - name: Install dependencies - run: gem install minitest -v "5.15.0" + run: gem install test-unit coveralls - name: Run test env: COVERALLS: "yes" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 07654a55a..4636288a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,6 @@ jobs: with: ruby-version: ${{ matrix.ruby }} - name: Install dependencies - run: gem install minitest -v "5.15.0" + run: gem install test-unit - name: Run test run: ruby -Ilib exe/rake diff --git a/Gemfile b/Gemfile index 04edfabcf..78bc01c96 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gemspec group :development do - gem "minitest" + gem "test-unit" gem "coveralls" gem "rubocop" end diff --git a/test/helper.rb b/test/helper.rb index 32456fde4..7ef6e6958 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -10,8 +10,7 @@ rescue Gem::LoadError end -gem "minitest", "~> 5" -require "minitest/autorun" +require "test/unit" require "rake" require "tmpdir" @@ -19,7 +18,7 @@ require_relative "support/ruby_runner" require_relative "support/rakefile_definitions" -class Rake::TestCase < Minitest::Test +class Rake::TestCase < Test::Unit::TestCase include FileCreation include Rake::DSL diff --git a/test/test_rake_application.rb b/test/test_rake_application.rb index df756a4ad..2d4e52c00 100644 --- a/test/test_rake_application.rb +++ b/test/test_rake_application.rb @@ -48,7 +48,7 @@ def test_display_exception_details rescue => ex end - out, err = capture_io do + out, err = capture_output do @app.set_default_options # reset trace output IO @app.display_error_message ex @@ -72,7 +72,7 @@ def detailed_message(**) rescue error_class => ex end - out, err = capture_io do + out, err = capture_output do @app.set_default_options # reset trace output IO @app.display_error_message ex @@ -91,7 +91,7 @@ def test_display_exception_details_bad_encoding rescue => ex end - out, err = capture_io do + out, err = capture_output do @app.set_default_options # reset trace output IO @app.display_error_message ex @@ -111,7 +111,7 @@ def test_display_exception_details_cause end end - out, err = capture_io do + out, err = capture_output do @app.set_default_options # reset trace output IO @app.display_error_message ex @@ -129,7 +129,7 @@ def test_display_tasks @app.options.show_task_pattern = // @app.last_description = "COMMENT" @app.define_task(Rake::Task, "t") - out, = capture_io do @app.instance_eval { display_tasks_and_comments } end + out, = capture_output do @app.instance_eval { display_tasks_and_comments } end assert_match(/^rake t/, out) assert_match(/# COMMENT/, out) end @@ -142,7 +142,7 @@ def test_display_tasks_with_long_comments @app.last_description = numbers @app.define_task(Rake::Task, "t") - out, = capture_io do @app.instance_eval { display_tasks_and_comments } end + out, = capture_output do @app.instance_eval { display_tasks_and_comments } end assert_match(/^rake t/, out) assert_match(/# #{numbers[0, 65]}\.\.\./, out) @@ -156,7 +156,7 @@ def test_display_tasks_with_task_name_wider_than_tty_display @app.last_description = "something short" @app.define_task(Rake::Task, task_name) - out, = capture_io do @app.instance_eval { display_tasks_and_comments } end + out, = capture_output do @app.instance_eval { display_tasks_and_comments } end # Ensure the entire task name is output and we end up showing no description assert_match(/rake #{task_name} # .../, out) @@ -171,7 +171,7 @@ def test_display_tasks_with_very_long_task_name_to_a_non_tty_shows_name_and_comm @app.last_description = "something short" @app.define_task(Rake::Task, task_name) - out, = capture_io do @app.instance_eval { display_tasks_and_comments } end + out, = capture_output do @app.instance_eval { display_tasks_and_comments } end # Ensure the entire task name is output and we end up showing no description assert_match(/rake #{task_name} # #{description}/, out) @@ -183,7 +183,7 @@ def test_display_tasks_with_long_comments_to_a_non_tty_shows_entire_comment @app.tty_output = false @app.last_description = "1234567890" * 8 @app.define_task(Rake::Task, "t") - out, = capture_io do @app.instance_eval { display_tasks_and_comments } end + out, = capture_output do @app.instance_eval { display_tasks_and_comments } end assert_match(/^rake t/, out) assert_match(/# #{@app.last_description}/, out) end @@ -197,7 +197,7 @@ def test_truncating_comments_to_a_non_tty @app.last_description = numbers @app.define_task(Rake::Task, "t") - out, = capture_io do @app.instance_eval { display_tasks_and_comments } end + out, = capture_output do @app.instance_eval { display_tasks_and_comments } end assert_match(/^rake t/, out) assert_match(/# #{numbers[0, 65]}\.\.\./, out) @@ -208,7 +208,7 @@ def test_describe_tasks @app.options.show_task_pattern = // @app.last_description = "COMMENT" @app.define_task(Rake::Task, "t") - out, = capture_io do @app.instance_eval { display_tasks_and_comments } end + out, = capture_output do @app.instance_eval { display_tasks_and_comments } end assert_match(/^rake t$/, out) assert_match(/^ {4}COMMENT$/, out) end @@ -219,7 +219,7 @@ def test_show_lines @app.last_description = "COMMENT" @app.define_task(Rake::Task, "t") @app["t"].locations << "HERE:1" - out, = capture_io do @app.instance_eval { display_tasks_and_comments } end + out, = capture_output do @app.instance_eval { display_tasks_and_comments } end assert_match(/^rake t +[^:]+:\d+ *$/, out) end @@ -251,7 +251,7 @@ def test_load_rakefile def test_load_rakefile_doesnt_print_rakefile_directory_from_same_dir rakefile_unittest - _, err = capture_io do + _, err = capture_output do @app.instance_eval do # pretend we started from the unittest dir @original_dir = File.expand_path(".") @@ -283,7 +283,7 @@ def test_load_rakefile_prints_rakefile_directory_from_subdir app = Rake::Application.new app.options.rakelib = [] - _, err = capture_io do + _, err = capture_output do app.instance_eval do raw_load_rakefile end @@ -296,7 +296,7 @@ def test_load_rakefile_doesnt_print_rakefile_directory_from_subdir_if_silent rakefile_unittest Dir.chdir "subdir" - _, err = capture_io do + _, err = capture_output do @app.instance_eval do handle_options [] options.silent = true @@ -308,7 +308,7 @@ def test_load_rakefile_doesnt_print_rakefile_directory_from_subdir_if_silent end def test_load_rakefile_not_found - skip if jruby9? + omit if jruby9? Dir.chdir @tempdir ENV["RAKE_SYSTEM"] = "not_exist" @@ -455,7 +455,7 @@ def test_good_run rakefile_default - out, err = capture_io do + out, err = capture_output do @app.run %w[--rakelib=""] end @@ -468,7 +468,7 @@ def test_display_task_run ran = false @app.last_description = "COMMENT" @app.define_task(Rake::Task, "default") - out, = capture_io { @app.run %w[-f -s --tasks --rakelib=""] } + out, = capture_output { @app.run %w[-f -s --tasks --rakelib=""] } assert @app.options.show_tasks assert ! ran assert_match(/rake default/, out) @@ -482,7 +482,7 @@ def test_display_prereqs t.enhance([:a, :b]) @app.define_task(Rake::Task, "a") @app.define_task(Rake::Task, "b") - out, = capture_io { @app.run %w[-f -s --prereqs --rakelib=""] } + out, = capture_output { @app.run %w[-f -s --prereqs --rakelib=""] } assert @app.options.show_prereqs assert ! ran assert_match(/rake a$/, out) @@ -492,7 +492,7 @@ def test_display_prereqs def test_bad_run @app.intern(Rake::Task, "default").enhance { fail } - _, err = capture_io { + _, err = capture_output { assert_raises(SystemExit) { @app.run %w[-f -s --rakelib=""] } } assert_match(/see full trace/i, err) @@ -500,7 +500,7 @@ def test_bad_run def test_bad_run_with_trace @app.intern(Rake::Task, "default").enhance { fail } - _, err = capture_io { + _, err = capture_output { @app.set_default_options assert_raises(SystemExit) { @app.run %w[-f -s -t] } } @@ -509,7 +509,7 @@ def test_bad_run_with_trace def test_bad_run_with_backtrace @app.intern(Rake::Task, "default").enhance { fail } - _, err = capture_io { + _, err = capture_output { assert_raises(SystemExit) { @app.run %w[-f -s --backtrace] } @@ -523,7 +523,7 @@ def test_bad_run_includes_exception_name @app.intern(Rake::Task, "default").enhance { raise CustomError, "intentional" } - _, err = capture_io { + _, err = capture_output { assert_raises(SystemExit) { @app.run %w[-f -s] } @@ -535,7 +535,7 @@ def test_rake_error_excludes_exception_name @app.intern(Rake::Task, "default").enhance { fail "intentional" } - _, err = capture_io { + _, err = capture_output { assert_raises(SystemExit) { @app.run %w[-f -s] } @@ -558,7 +558,7 @@ def test_printing_original_exception_cause raise custom_error, "Secondary Error" end } - _ ,err = capture_io { + _ ,err = capture_output { assert_raises(SystemExit) { @app.run %w[-f -s] } @@ -572,12 +572,12 @@ def test_printing_original_exception_cause def test_run_with_bad_options @app.intern(Rake::Task, "default").enhance { fail } assert_raises(SystemExit) { - capture_io { @app.run %w[-f -s --xyzzy] } + capture_output { @app.run %w[-f -s --xyzzy] } } end def test_standard_exception_handling_invalid_option - out, err = capture_io do + out, err = capture_output do e = assert_raises SystemExit do @app.standard_exception_handling do raise OptionParser::InvalidOption, "blah" @@ -592,7 +592,7 @@ def test_standard_exception_handling_invalid_option end def test_standard_exception_handling_other - out, err = capture_io do + out, err = capture_output do @app.set_default_options # reset trace output IO e = assert_raises SystemExit do @@ -610,7 +610,7 @@ def test_standard_exception_handling_other end def test_standard_exception_handling_system_exit - out, err = capture_io do + out, err = capture_output do e = assert_raises SystemExit do @app.standard_exception_handling do exit 0 @@ -625,7 +625,7 @@ def test_standard_exception_handling_system_exit end def test_standard_exception_handling_system_exit_nonzero - out, err = capture_io do + out, err = capture_output do e = assert_raises SystemExit do @app.standard_exception_handling do exit 5 diff --git a/test/test_rake_application_options.rb b/test/test_rake_application_options.rb index 92bbeed86..241db55cd 100644 --- a/test/test_rake_application_options.rb +++ b/test/test_rake_application_options.rb @@ -107,7 +107,7 @@ def test_execute_and_continue def test_execute_and_print $xyzzy = 0 - out, = capture_io do + out, = capture_output do flags('--execute-print=$xyzzy="pugh"', '-p $xyzzy="pugh"') do assert_equal "pugh", $xyzzy assert_equal :exit, @exit @@ -119,7 +119,7 @@ def test_execute_and_print end def test_help - out, = capture_io do + out, = capture_output do flags "--help", "-H", "-h" end @@ -200,7 +200,7 @@ def test_require end def test_missing_require - skip if jruby? + omit if jruby? ex = assert_raises(LoadError) do flags(["--require", "test/missing"]) do |opts| @@ -386,7 +386,7 @@ def test_no_deprecated_messages end def test_verbose - capture_io do + capture_output do flags("--verbose", "-v") do |opts| assert Rake::FileUtilsExt.verbose_flag, "verbose should be true" assert ! opts.silent, "opts should not be silent" @@ -395,7 +395,7 @@ def test_verbose end def test_version - out, _ = capture_io do + out, _ = capture_output do flags "--version", "-V" end @@ -405,7 +405,7 @@ def test_version end def test_bad_option - _, err = capture_io do + _, err = capture_output do ex = assert_raises(OptionParser::InvalidOption) do flags("--bad-option") end diff --git a/test/test_rake_backtrace.rb b/test/test_rake_backtrace.rb index 05a2dfda1..f605384e2 100644 --- a/test/test_rake_backtrace.rb +++ b/test/test_rake_backtrace.rb @@ -40,7 +40,7 @@ class TestRakeBacktrace < Rake::TestCase # :nodoc: def setup super - skip "tmpdir is suppressed in backtrace" if + omit "tmpdir is suppressed in backtrace" if Rake::Backtrace::SUPPRESS_PATTERN =~ Dir.pwd end diff --git a/test/test_rake_clean.rb b/test/test_rake_clean.rb index 8fb6a715e..dfc8a2192 100644 --- a/test/test_rake_clean.rb +++ b/test/test_rake_clean.rb @@ -19,7 +19,7 @@ def test_clean def test_cleanup file_name = create_undeletable_file - out, _ = capture_io do + out, _ = capture_output do Rake::Cleaner.cleanup(file_name, verbose: false) end assert_match(/failed to remove/i, out) @@ -31,7 +31,7 @@ def test_cleanup def test_cleanup_ignores_missing_files file_name = File.join(@tempdir, "missing_directory", "no_such_file") - out, _ = capture_io do + out, _ = capture_output do Rake::Cleaner.cleanup(file_name, verbose: false) end refute_match(/failed to remove/i, out) @@ -40,7 +40,7 @@ def test_cleanup_ignores_missing_files def test_cleanup_trace file_name = create_file - out, err = capture_io do + out, err = capture_output do with_trace true do Rake::Cleaner.cleanup(file_name) end @@ -59,27 +59,31 @@ def test_cleanup_trace def test_cleanup_without_trace file_name = create_file - assert_output "", "" do + out, err = capture_output do with_trace false do Rake::Cleaner.cleanup(file_name) end end + assert_empty out + assert_empty err end def test_cleanup_opt_overrides_trace_silent file_name = create_file - assert_output "", "" do + out, err = capture_output do with_trace true do Rake::Cleaner.cleanup(file_name, verbose: false) end end + assert_empty out + assert_empty err end def test_cleanup_opt_overrides_trace_verbose file_name = create_file - out, err = capture_io do + out, err = capture_output do with_trace false do Rake::Cleaner.cleanup(file_name, verbose: true) end @@ -115,7 +119,7 @@ def create_undeletable_file rescue file_name else - skip "Permission to delete files is different on this system" + omit "Permission to delete files is different on this system" end end @@ -132,7 +136,7 @@ def with_trace(value) old, Rake.application.options.trace = Rake.application.options.trace, value - # FileUtils caches the $stderr object, which breaks capture_io et. al. + # FileUtils caches the $stderr object, which breaks capture_output et. al. # We hack it here where it's convenient to do so. Rake::Cleaner.instance_variable_set :@fileutils_output, nil yield diff --git a/test/test_rake_cpu_counter.rb b/test/test_rake_cpu_counter.rb index 5d04e7c97..fd00b888f 100644 --- a/test/test_rake_cpu_counter.rb +++ b/test/test_rake_cpu_counter.rb @@ -11,7 +11,7 @@ def setup def test_count num = @cpu_counter.count - skip "cannot count CPU" if num == nil + omit "cannot count CPU" if num == nil assert_kind_of Numeric, num assert_operator num, :>=, 1 end diff --git a/test/test_rake_file_list.rb b/test/test_rake_file_list.rb index 94572e92b..0527b03c6 100644 --- a/test/test_rake_file_list.rb +++ b/test/test_rake_file_list.rb @@ -383,7 +383,7 @@ def test_egrep_returns_0_if_no_matches def test_egrep_with_output files = FileList["*.txt"] - out, = capture_io do + out, = capture_output do files.egrep(/XYZZY/) end @@ -404,7 +404,7 @@ def test_egrep_with_block def test_egrep_with_error files = FileList["*.txt"] - _, err = capture_io do + _, err = capture_output do files.egrep(/XYZZY/) do |fn, ln, line | raise "_EGREP_FAILURE_" end @@ -519,7 +519,8 @@ def test_cloned_items_stay_frozen a = FileList["a", "b", "c"] a.freeze c = a.clone - assert_raises(TypeError, RuntimeError) do + error_class = defined?(FrozenError) ? FrozenError : RuntimeError + assert_raises(error_class) do c << "more" end end diff --git a/test/test_rake_file_utils.rb b/test/test_rake_file_utils.rb index 0fd7de494..42dccac6c 100644 --- a/test/test_rake_file_utils.rb +++ b/test/test_rake_file_utils.rb @@ -129,7 +129,7 @@ def test_nowrite def test_file_utils_methods_are_available_at_top_level create_file("a") - capture_io do + capture_output do rm_rf "a" end @@ -171,7 +171,7 @@ def test_sh_with_env end def test_sh_with_multiple_arguments - skip if jruby9? # https://github.com/jruby/jruby/issues/3653 + omit if jruby9? # https://github.com/jruby/jruby/issues/3653 check_no_expansion ENV["RAKE_TEST_SH"] = "someval" @@ -182,7 +182,7 @@ def test_sh_with_multiple_arguments end def test_sh_with_spawn_options - skip "JRuby does not support spawn options" if jruby? + omit "JRuby does not support spawn options" if jruby? echocommand @@ -198,7 +198,7 @@ def test_sh_with_spawn_options end def test_sh_with_hash_option - skip "JRuby does not support spawn options" if jruby? + omit "JRuby does not support spawn options" if jruby? check_expansion verbose(false) { @@ -243,7 +243,7 @@ def test_sh_noop def test_sh_bad_option # Skip on JRuby because option checking is performed by spawn via system # now. - skip "JRuby does not support spawn options" if jruby? + omit "JRuby does not support spawn options" if jruby? shellcommand @@ -256,7 +256,7 @@ def test_sh_bad_option def test_sh_verbose shellcommand - _, err = capture_io do + _, err = capture_output do verbose(true) { sh %{shellcommand.rb}, noop: true } @@ -268,7 +268,7 @@ def test_sh_verbose def test_sh_verbose_false shellcommand - _, err = capture_io do + _, err = capture_output do verbose(false) { sh %{shellcommand.rb}, noop: true } @@ -282,9 +282,10 @@ def test_sh_verbose_flag_nil RakeFileUtils.verbose_flag = nil - assert_silent do + out, _ = capture_output do sh %{shellcommand.rb}, noop: true end + assert_empty out end def test_ruby_with_a_single_string_argument @@ -341,6 +342,43 @@ def test_sh_if_a_command_exits_with_error_status_sh_echoes_it_fully end end + # https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L188 + def _synchronize + yield + end + + # https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L546 + def capture_subprocess_io + _synchronize do + begin + require "tempfile" + + captured_stdout = Tempfile.new("out") + captured_stderr = Tempfile.new("err") + + orig_stdout = $stdout.dup + orig_stderr = $stderr.dup + $stdout.reopen captured_stdout + $stderr.reopen captured_stderr + + yield + + $stdout.rewind + $stderr.rewind + + return captured_stdout.read, captured_stderr.read + ensure + $stdout.reopen orig_stdout + $stderr.reopen orig_stderr + + orig_stdout.close + orig_stderr.close + captured_stdout.close! + captured_stderr.close! + end + end + end + def assert_echoes_fully long_string = "1234567890" * 10 shell_command = "ruby -e\"'#{long_string}';exit false\"" @@ -357,7 +395,7 @@ def assert_echoes_fully end def test_ruby_with_multiple_arguments - skip if jruby9? # https://github.com/jruby/jruby/issues/3653 + omit if jruby9? # https://github.com/jruby/jruby/issues/3653 check_no_expansion diff --git a/test/test_rake_functional.rb b/test/test_rake_functional.rb index afc31d28f..6ab005f53 100644 --- a/test/test_rake_functional.rb +++ b/test/test_rake_functional.rb @@ -123,7 +123,7 @@ def test_by_default_rakelib_files_are_included end def test_implicit_system - skip if jruby9? + omit if jruby9? rake_system_dir Dir.chdir @tempdir @@ -442,7 +442,7 @@ def test_comment_separated_from_task_by_blank_line_is_not_picked_up rake "-T" - refute_match("t2", @out) + refute_match(/t2/, @out) end def test_comment_after_desc_is_ignored @@ -470,7 +470,7 @@ def test_correct_number_of_tasks_reported end def test_file_list_is_requirable_separately - skip if jruby9? # https://github.com/jruby/jruby/issues/3655 + omit if jruby9? # https://github.com/jruby/jruby/issues/3655 ruby "-rrake/file_list", "-e", 'puts Rake::FileList["a"].size' assert_equal "1\n", @out @@ -496,12 +496,12 @@ def test_signal_propagation_in_tests assert_match(/ATEST/, @out) refute_match(/BTEST/, @out) else - skip "Signal detect seems broken on this system" + omit "Signal detect seems broken on this system" end end def test_failing_test_sets_exit_status - skip if uncertain_exit_status? + omit if uncertain_exit_status? rakefile_failing_test_task rake assert @exit.exitstatus > 0, "should be non-zero" @@ -520,7 +520,7 @@ def test_stand_alone_filelist # We are unable to accurately verify that Rake returns a proper # error exit status using popen3 in Ruby 1.8.7 and JRuby. This - # predicate function can be used to skip tests or assertions as + # predicate function can be used to omit tests or assertions as # needed. def uncertain_exit_status? defined?(JRUBY_VERSION) diff --git a/test/test_rake_rake_test_loader.rb b/test/test_rake_rake_test_loader.rb index 4f481cd28..6bde77d9c 100644 --- a/test/test_rake_rake_test_loader.rb +++ b/test/test_rake_rake_test_loader.rb @@ -25,7 +25,7 @@ def test_pattern end def test_load_error_from_missing_test_file - out, err = capture_io do + out, err = capture_output do ARGV.replace %w[no_such_test_file.rb] assert_raises SystemExit do @@ -47,7 +47,7 @@ def test_load_error_from_missing_test_file def test_load_error_raised_implicitly File.write("error_test.rb", "require 'superkalifragilisticoespialidoso'") - out, err = capture_io do + out, err = capture_output do ARGV.replace %w[error_test.rb] exc = assert_raises(LoadError) do @@ -65,7 +65,7 @@ def test_load_error_raised_implicitly def test_load_error_raised_explicitly File.write("error_test.rb", "raise LoadError, 'explicitly raised'") - out, err = capture_io do + out, err = capture_output do ARGV.replace %w[error_test.rb] exc = assert_raises(LoadError) do diff --git a/test/test_rake_task.rb b/test/test_rake_task.rb index bffe2cb59..7dc18aee4 100644 --- a/test/test_rake_task.rb +++ b/test/test_rake_task.rb @@ -64,7 +64,7 @@ def test_invoke_with_circular_dependencies def test_dry_run_prevents_actions runlist = [] t1 = task(:t1) { |t| runlist << t.name; 3321 } - _, err = capture_io { + _, err = capture_output { Rake.application.set_default_options # reset trace output IO Rake.application.options.dryrun = true @@ -80,7 +80,7 @@ def test_dry_run_prevents_actions def test_tasks_can_be_traced t1 = task(:t1) - _, err = capture_io { + _, err = capture_output { Rake.application.set_default_options # reset trace output IO Rake.application.options.trace = true diff --git a/test/test_rake_task_with_arguments.rb b/test/test_rake_task_with_arguments.rb index 36dfa2646..5cd5d0e98 100644 --- a/test/test_rake_task_with_arguments.rb +++ b/test/test_rake_task_with_arguments.rb @@ -83,7 +83,7 @@ def test_actions_of_various_arity_are_ok_with_args def test_actions_adore_keywords # https://github.com/ruby/rake/pull/174#issuecomment-263460761 - skip if jruby9? + omit if jruby9? eval <<-RUBY, binding, __FILE__, __LINE__+1 notes = [] t = task :t, [:reqr, :ovrd, :dflt] # required, overridden-optional, default-optional diff --git a/test/test_rake_top_level_functions.rb b/test/test_rake_top_level_functions.rb index f0dec1b76..b29e2368d 100644 --- a/test/test_rake_top_level_functions.rb +++ b/test/test_rake_top_level_functions.rb @@ -46,7 +46,7 @@ def test_import end def test_when_writing - out, = capture_io do + out, = capture_output do when_writing("NOTWRITING") do puts "WRITING" end @@ -56,7 +56,7 @@ def test_when_writing def test_when_not_writing Rake::FileUtilsExt.nowrite_flag = true - _, err = capture_io do + _, err = capture_output do when_writing("NOTWRITING") do puts "WRITING" end diff --git a/test/test_rake_win32.rb b/test/test_rake_win32.rb index ed08ef09e..474bf50e9 100644 --- a/test/test_rake_win32.rb +++ b/test/test_rake_win32.rb @@ -65,7 +65,7 @@ def test_win32_backtrace_with_different_case rake.options.trace = true rake.instance_variable_set(:@rakefile, "Rakefile") - _, err = capture_io { + _, err = capture_output { rake.set_default_options # reset trace output IO rake.display_error_message(ex) diff --git a/test/test_thread_history_display.rb b/test/test_thread_history_display.rb index 026576446..5d706ce34 100644 --- a/test/test_thread_history_display.rb +++ b/test/test_thread_history_display.rb @@ -12,7 +12,7 @@ def setup end def test_banner - out, _ = capture_io do + out, _ = capture_output do @display.show end assert_match(/Job History/i, out) @@ -20,7 +20,7 @@ def test_banner def test_item_queued @stats << event(:item_queued, item_id: 123) - out, _ = capture_io do + out, _ = capture_output do @display.show end assert_match(/^ *1000000 +A +item_queued +item_id:1$/, out) @@ -28,7 +28,7 @@ def test_item_queued def test_item_dequeued @stats << event(:item_dequeued, item_id: 123) - out, _ = capture_io do + out, _ = capture_output do @display.show end assert_match(/^ *1000000 +A +item_dequeued +item_id:1$/, out) @@ -37,7 +37,7 @@ def test_item_dequeued def test_multiple_items @stats << event(:item_queued, item_id: 123) @stats << event(:item_queued, item_id: 124) - out, _ = capture_io do + out, _ = capture_output do @display.show end assert_match(/^ *1000000 +A +item_queued +item_id:1$/, out) @@ -46,7 +46,7 @@ def test_multiple_items def test_waiting @stats << event(:waiting, item_id: 123) - out, _ = capture_io do + out, _ = capture_output do @display.show end assert_match(/^ *1000000 +A +waiting +item_id:1$/, out) @@ -54,7 +54,7 @@ def test_waiting def test_continue @stats << event(:continue, item_id: 123) - out, _ = capture_io do + out, _ = capture_output do @display.show end assert_match(/^ *1000000 +A +continue +item_id:1$/, out) @@ -65,7 +65,7 @@ def test_thread_deleted :thread_deleted, deleted_thread: 123_456, thread_count: 12) - out, _ = capture_io do + out, _ = capture_output do @display.show end assert_match( @@ -78,7 +78,7 @@ def test_thread_created :thread_created, new_thread: 123_456, thread_count: 13) - out, _ = capture_io do + out, _ = capture_output do @display.show end assert_match(