Permalink
Browse files

Fix trace/backtrace swallowing task name arguments.

  • Loading branch information...
1 parent e82809b commit 13dc28f7395af36d8c522c624233ddece755a957 @jimweirich committed Nov 16, 2012
Showing with 21 additions and 6 deletions.
  1. +1 −1 lib/rake/application.rb
  2. +20 −5 test/test_rake_application_options.rb
@@ -336,7 +336,7 @@ def standard_rake_options
options.show_all_tasks = value
}
],
- ['--backtrace [OUT]', "Enable full backtrace. OUT can be stderr (default) or stdout.",
+ ['--backtrace=[OUT]', "Enable full backtrace. OUT can be stderr (default) or stdout.",
lambda { |value|
options.backtrace = true
select_trace_output(options, 'backtrace', value)
@@ -228,7 +228,7 @@ def test_trace
end
def test_trace_with_stdout
- flags('--trace=stdout', '-tstdout', '-t stdout') do |opts|
+ flags('--trace=stdout', '-tstdout') do |opts|
assert opts.trace, "should enable trace option"
assert opts.backtrace, "should enabled backtrace option"
assert_equal $stdout, opts.trace_output
@@ -238,7 +238,7 @@ def test_trace_with_stdout
end
def test_trace_with_stderr
- flags('--trace=stderr', '-tstderr', '-t stderr') do |opts|
+ flags('--trace=stderr', '-tstderr') do |opts|
assert opts.trace, "should enable trace option"
assert opts.backtrace, "should enabled backtrace option"
assert_equal $stderr, opts.trace_output
@@ -254,13 +254,21 @@ def test_trace_with_error
assert_match(/un(known|recognized).*\btrace\b.*xyzzy/i, ex.message)
end
+ def test_trace_with_following_task_name
+ flags(['--trace', 'taskname'], ['-t', 'taskname']) do |opts|
+ assert opts.trace, "should enable trace option"
+ assert opts.backtrace, "should enabled backtrace option"
+ assert_equal $stderr, opts.trace_output
+ assert Rake::FileUtilsExt.verbose_flag
+ assert_equal ['taskname'], @app.top_level_tasks
+ end
+ end
def test_backtrace
flags('--backtrace') do |opts|
assert opts.backtrace, "should enable backtrace option"
assert_equal $stderr, opts.trace_output
assert ! opts.trace, "should not enable trace option"
- assert ! Rake::FileUtilsExt.verbose_flag
end
end
@@ -269,7 +277,6 @@ def test_backtrace_with_stdout
assert opts.backtrace, "should enable backtrace option"
assert_equal $stdout, opts.trace_output
assert ! opts.trace, "should not enable trace option"
- assert ! Rake::FileUtilsExt.verbose_flag
end
end
@@ -278,7 +285,6 @@ def test_backtrace_with_stderr
assert opts.backtrace, "should enable backtrace option"
assert_equal $stderr, opts.trace_output
assert ! opts.trace, "should not enable trace option"
- assert ! Rake::FileUtilsExt.verbose_flag
end
end
@@ -289,6 +295,15 @@ def test_backtrace_with_error
assert_match(/un(known|recognized).*\bbacktrace\b.*xyzzy/i, ex.message)
end
+ def test_backtrace_with_following_task_name
+ flags(['--backtrace', 'taskname']) do |opts|
+ assert ! opts.trace, "should enable trace option"
+ assert opts.backtrace, "should enabled backtrace option"
+ assert_equal $stderr, opts.trace_output
+ assert_equal ['taskname'], @app.top_level_tasks
+ end
+ end
+
def test_trace_rules
flags('--rules') do |opts|
assert opts.trace_rules

0 comments on commit 13dc28f

Please sign in to comment.