Skip to content

Commit 1f6fb61

Browse files
committedMay 9, 2021
fix testing pipe race condition
1 parent 0510a1e commit 1f6fb61

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed
 

‎tests/test_macros.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,22 @@ fn test_tls_set() {
147147
assert_eq!(tls_get!(V)[0], "a");
148148
}
149149

150-
#[test]
151-
fn test_pipe_fail() {
152-
assert!(run_cmd!(false | wc).is_err());
153-
assert!(run_cmd!(echo xx | false | wc | wc | wc).is_err());
154-
}
155-
156150
#[test]
157151
/// ```compile_fail
158152
/// run_cmd!(ls | |).unwrap();
159153
/// run_cmd!(ls | ||).unwrap();
160154
/// ```
161-
fn test_pipe_ok() {
155+
fn test_pipe() {
162156
use_builtin_cmd!(echo);
163157
assert!(run_cmd!(echo "xx").is_ok());
164158
assert_eq!(run_fun!(echo "xx").unwrap(), "xx");
165159
assert!(run_cmd!(echo xx | wc).is_ok());
166160
assert!(run_cmd!(echo xx | wc | wc | wc | wc).is_ok());
167161
assert!(run_cmd!(seq 1 10000000 | head -1).is_err());
168162

163+
assert!(run_cmd!(false | wc).is_err());
164+
assert!(run_cmd!(echo xx | false | wc | wc | wc).is_err());
165+
169166
set_pipefail(false);
170167
assert!(run_cmd!(du -ah . | sort -hr | head -n 10).is_ok());
171168
set_pipefail(true);

0 commit comments

Comments
 (0)
Please sign in to comment.