diff --git a/exe/retest b/exe/retest index 927a906e..5f24a8f9 100755 --- a/exe/retest +++ b/exe/retest @@ -32,8 +32,8 @@ runner = Retest::Runners.runner_for(command.to_s, command_stdin: runner_rd) sounds = Retest::Sounds.for(options) # All test runner -all_test_runner = Retest::Runners.runner_for( - Retest::Command.for_options(options.dup.tap { |opts| opts.params[:all] = true }).to_s) +all_test_command = Retest::Command.for_options(options.merge(%w[--all])) +all_test_runner = Retest::Runners.runner_for(all_test_command.to_s) all_test_runner.add_observer(sounds) sounds.play(:start) @@ -47,6 +47,8 @@ program = Retest::Program.new( ) if options.params[:diff] + prompt.input = $stdin + runner.command_stdin = $stdin program.diff(options.params[:diff]) return end @@ -85,8 +87,8 @@ loop do puts "input is: #{input.inspect}" - if runner.running? - runner_wr.puts input + if prompt.question_asked? + prompt_wr.puts input next end diff --git a/lib/retest/options.rb b/lib/retest/options.rb index ff890092..01029ce9 100644 --- a/lib/retest/options.rb +++ b/lib/retest/options.rb @@ -158,5 +158,9 @@ def force_polling? def extension Regexp.new(params[:ext]) end + + def merge(options = []) + self.class.new(@args.dup.concat(options)) + end end end \ No newline at end of file diff --git a/test/retest/options_test.rb b/test/retest/options_test.rb index c21315d0..675d27c0 100644 --- a/test/retest/options_test.rb +++ b/test/retest/options_test.rb @@ -48,5 +48,14 @@ def test_notify? @subject.args = ["--notify"] assert @subject.notify? end + + def test_all_version_copy + @subject.args = %w[--notify --rake] + + copy = @subject.merge(%w[--all]) + + assert_equal %w[--notify --rake --all], copy.args + refute_equal copy.object_id, @subject.object_id + end end end \ No newline at end of file