]> git.lizzy.rs Git - rust.git/commitdiff
rustpkg: Make test_rustpkg_test_output more permissive
authorTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 1 Oct 2013 00:31:59 +0000 (17:31 -0700)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Tue, 1 Oct 2013 00:35:47 +0000 (17:35 -0700)
test output may contain color codes, so check for several small strings
instead of one big one.

src/librustpkg/tests.rs

index 87abff45dc7594755c3adf34001c4a97204ab9ae..604620d4ea456922e7672618fd7b5bbae2e4e460 100644 (file)
@@ -1812,9 +1812,11 @@ fn test_rustpkg_test_output() {
     let workspace = create_local_package_with_test(&PkgId::new("foo"));
     let output = command_line_test([~"test", ~"foo"], &workspace);
     let output_str = str::from_utf8(output.output);
-    assert!(output_str.contains("test f ... ok"));
-    assert!(output_str.contains(
-        "test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured"));
+    // The first two assertions are separate because test output may
+    // contain color codes, which could appear between "test f" and "ok".
+    assert!(output_str.contains("test f"));
+    assert!(output_str.contains("ok"));
+    assert!(output_str.contains("1 passed; 0 failed; 0 ignored; 0 measured"));
 }
 
 #[test]