Skip to content

Commit

Permalink
Move pipe related test cases into one
Browse files Browse the repository at this point in the history
to avoid setting pipefail flags concurrently
  • Loading branch information
tao-guo committed Sep 4, 2024
1 parent 8090c39 commit 2b81c8b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/test_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ fn test_pipe() {

let wc_cmd = "wc";
assert!(run_cmd!(ls | $wc_cmd).is_ok());

// test pipefail
assert!(run_cmd!(false | true).is_err());
assert!(run_fun!(false | true).is_err());
assert!(run_fun!(ignore false | true).is_ok());
set_pipefail(false);
assert!(run_fun!(ignore false | true).is_ok());
set_pipefail(true);
}

#[test]
Expand Down Expand Up @@ -255,13 +263,3 @@ fn test_empty_arg() {
let opt = "";
assert!(run_cmd!(ls $opt).is_ok());
}

#[test]
fn test_pipefail_in_fun() {
assert!(run_cmd!(false | true).is_err());
assert!(run_fun!(false | true).is_err());
assert!(run_fun!(ignore false | true).is_ok());
set_pipefail(false);
assert!(run_fun!(ignore false | true).is_ok());
set_pipefail(true);
}

0 comments on commit 2b81c8b

Please sign in to comment.