test/test_command.rb in mercurial-ruby-0.7.0 vs test/test_command.rb in mercurial-ruby-0.7.1

- old
+ new

@@ -14,9 +14,19 @@ it "should translate shell errors to ruby exceptions" do lambda{ Mercurial::Command.new("cd #{ @repository.path } && hg shikaka").execute }.must_raise Mercurial::CommandError end + + it "should not translate exit status of zero with shell errors to ruby exceptions" do + Mercurial::Command.new("echo stderr >&2 && echo stdout && exit 0").execute.strip.must_equal "stdout" + end + + it "should translate exit status of non-zero with shell errors to ruby exceptions" do + lambda{ + Mercurial::Command.new("echo stderr >&2 && echo stdout && exit 1").execute + }.must_raise Mercurial::CommandError + end it "should execute commands with timeout" do Mercurial.configuration.stubs(:shell_timeout).returns(1) lambda{ Mercurial::Command.new("sleep 6").execute