Skip to content

Commit bc6dd90

Browse files
committed
auto merge of #9640 : catamorphism/rust/rustpkg-test-fix, r=alexcrichton
r? @alexcrichton test output may contain color codes, so check for several small strings instead of one big one.
2 parents 7ddcd2a + 2ec2d7d commit bc6dd90

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/librustpkg/tests.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,9 +1812,11 @@ fn test_rustpkg_test_output() {
18121812
let workspace = create_local_package_with_test(&PkgId::new("foo"));
18131813
let output = command_line_test([~"test", ~"foo"], &workspace);
18141814
let output_str = str::from_utf8(output.output);
1815-
assert!(output_str.contains("test f ... ok"));
1816-
assert!(output_str.contains(
1817-
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured"));
1815+
// The first two assertions are separate because test output may
1816+
// contain color codes, which could appear between "test f" and "ok".
1817+
assert!(output_str.contains("test f"));
1818+
assert!(output_str.contains("ok"));
1819+
assert!(output_str.contains("1 passed; 0 failed; 0 ignored; 0 measured"));
18181820
}
18191821
18201822
#[test]

0 commit comments

Comments
 (0)