Skip to content

Commit

Permalink
Add integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronriekenberg committed Feb 11, 2024
1 parent 8c657b9 commit d05edaa
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,42 @@ fn runs_shell_function_from_stdin_no_run_if_empty_j1() {
))
.stderr(predicate::str::is_empty());
}

#[test]
fn test_exit_status_on_failing_commands() {
rust_parallel()
.arg("-j1")
.arg("cat")
.arg(":::")
.arg("A")
.arg("B")
.arg("C")
.assert()
.failure()
.code(1)
.stdout(predicate::str::contains(
"fatal error in main:\n3 commands failed",
))
.stderr(predicate::str::contains(
"cat: A: No such file or directory\ncat: B: No such file or directory\ncat: C: No such file or directory"
));
}

#[test]
fn test_exit_status_on_failing_commands_exit_on_error() {
rust_parallel()
.arg("-j1")
.arg("--exit-on-error")
.arg("cat")
.arg(":::")
.arg("A")
.arg("B")
.arg("C")
.assert()
.failure()
.code(1)
.stdout(predicate::str::contains("command failed").count(1))
.stderr(predicate::str::contains(
"cat: A: No such file or directory",
));
}

0 comments on commit d05edaa

Please sign in to comment.