Permalink
Browse files

Fix trace swallowing task name arguments.

  • Loading branch information...
1 parent 04f4b85 commit e82809b32cb2e0ec61d03eb47c958e16c49adcb2 @jimweirich committed Nov 16, 2012
Showing with 32 additions and 1 deletion.
  1. +1 −1 lib/rake/application.rb
  2. +31 −0 test/test_rake_application.rb
View
@@ -467,7 +467,7 @@ def standard_rake_options
select_tasks_to_show(options, :tasks, value)
}
],
- ['--trace', '-t [OUT]', "Turn on invoke/execute tracing, enable full backtrace. OUT can be stderr (default) or stdout.",
+ ['--trace=[OUT]', '-t', "Turn on invoke/execute tracing, enable full backtrace. OUT can be stderr (default) or stdout.",
lambda { |value|
options.trace = true
options.backtrace = true
@@ -309,6 +309,37 @@ def test_handle_options_should_strip_options_from_ARGV
assert @app.options.trace
end
+ def test_handle_options_trace_default_is_stderr
+ ARGV.clear
+ ARGV << "--trace"
+
+ @app.handle_options
+
+ assert_equal STDERR, @app.options.trace_output
+ assert @app.options.trace
+ end
+
+ def test_handle_options_trace_overrides_to_stdout
+ ARGV.clear
+ ARGV << "--trace=stdout"
+
+ @app.handle_options
+
+ assert_equal STDOUT, @app.options.trace_output
+ assert @app.options.trace
+ end
+
+ def test_handle_options_trace_does_not_eat_following_task_names
+ assert !@app.options.trace
+
+ ARGV.clear
+ ARGV << "--trace" << "sometask"
+
+ @app.handle_options
+ assert ARGV.include?("sometask")
+ assert @app.options.trace
+ end
+
def test_good_run
ran = false

0 comments on commit e82809b

Please sign in to comment.