From 55bfef22641a11a8447e8cda84aab2d7f96bdbf1 Mon Sep 17 00:00:00 2001 From: "Mark D. Blackwell" Date: Fri, 29 Jul 2016 17:03:46 -0400 Subject: [PATCH 1/2] Add test to prompt use of TESTOPTS --- test/support/rakefile_definitions.rb | 10 ++++++++++ test/test_rake_functional.rb | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/test/support/rakefile_definitions.rb b/test/support/rakefile_definitions.rb index d276b2fd5..b4eddb20b 100644 --- a/test/support/rakefile_definitions.rb +++ b/test/support/rakefile_definitions.rb @@ -49,6 +49,16 @@ def rakefile_test_task RAKEFILE end + def rakefile_test_task_verbose + rakefile <<-RAKEFILE + require "rake/testtask" + + Rake::TestTask.new(:unit) do |t| + t.verbose = true + end + RAKEFILE + end + def rakefile_chains rakefile <<-DEFAULT task :default => "play.app" diff --git a/test/test_rake_functional.rb b/test/test_rake_functional.rb index 9113d8616..0d3e1d0c0 100644 --- a/test/test_rake_functional.rb +++ b/test/test_rake_functional.rb @@ -384,6 +384,20 @@ def test_test_task_descriptions assert_match(/custom test task description/, @out) end + def test_test_task_when_verbose_unless_verbose_passed_not_prompt_testopts + rakefile_test_task_verbose + rake 'unit' + exp = /TESTOPTS="--verbose" to pass --verbose/ + refute_match exp, @out + end + + def test_test_task_when_verbose_passed_prompts_testopts + rakefile_test_task + rake '--verbose', 'unit' + exp = /TESTOPTS="--verbose" to pass --verbose/ + assert_match exp, @out + end + def test_comment_before_task_acts_like_desc rakefile_comments From 2a9a472a956aa952f75ef0027343aa71fbaf9fc2 Mon Sep 17 00:00:00 2001 From: "Mark D. Blackwell" Date: Fri, 29 Jul 2016 00:25:07 -0400 Subject: [PATCH 2/2] Prompt use of TESTOPTS --- lib/rake/testtask.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb index 4c6f71917..cf9855147 100644 --- a/lib/rake/testtask.rb +++ b/lib/rake/testtask.rb @@ -107,6 +107,8 @@ def define desc @description task @name => Array(deps) do FileUtilsExt.verbose(@verbose) do + puts "Use TESTOPTS=\"--verbose\" to pass --verbose" \ + ", etc. to runners." if ARGV.include? '--verbose' args = "#{ruby_opts_string} #{run_code} " + "#{file_list_string} #{option_list}"