Skip to content

Commit 15c9761

Browse files
committed
Disable terminal color in test when necessary
1 parent addb49c commit 15c9761

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tests/data/script-test-extra-args.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
fn main() {}
22

33
#[test]
4-
fn test() { println!("Hello, world!"); }
4+
fn test() {
5+
println!("Hello, world!");
6+
}

tests/tests/script.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ fn test_script_test() {
9494

9595
#[test]
9696
fn test_script_test_extra_args_for_cargo() {
97-
let out = rust_script!("--test", "tests/data/script-test-extra-args.rs", "--help").unwrap();
97+
let out = rust_script!(
98+
"--test",
99+
"tests/data/script-test-extra-args.rs",
100+
"--help",
101+
"--color",
102+
"never"
103+
)
104+
.unwrap();
98105
assert!(out.success());
99106
assert!(out.stdout.contains("Usage: cargo test "));
100107
}

0 commit comments

Comments
 (0)