From c8a424844f1db6b54793273234c07baea39fb5f4 Mon Sep 17 00:00:00 2001 From: Tao Guo Date: Wed, 4 Sep 2024 12:18:29 -0700 Subject: [PATCH] Move pipe related test cases into one to avoid setting pipefail flags concurrently --- tests/test_macros.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/test_macros.rs b/tests/test_macros.rs index 4649c3b..5339108 100644 --- a/tests/test_macros.rs +++ b/tests/test_macros.rs @@ -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!(false | true).is_ok()); + set_pipefail(true); } #[test] @@ -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); -}