From 4358288600e44faa0c883c96383c7d2b18f83b2c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 31 Oct 2014 11:17:29 -0700 Subject: [PATCH] Fix lines_match test for matching process output --- tests/support/mod.rs | 4 ++-- tests/test_cargo_bench.rs | 10 +++++----- tests/test_cargo_compile.rs | 2 +- tests/test_cargo_compile_old_custom_build.rs | 4 ++-- tests/test_cargo_publish.rs | 4 ++-- tests/test_cargo_test.rs | 10 +++++----- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 544e9800d..ff61bb06f 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -347,13 +347,13 @@ impl Execs { fn lines_match(expected: &str, mut actual: &str) -> bool { for part in expected.split_str("[..]") { match actual.find_str(part) { - Some(i) => actual = actual.slice_from(i), + Some(i) => actual = actual.slice_from(i + part.len()), None => { return false } } } - return true; + actual.len() == 0 || expected.ends_with("[..]") } struct ZipAll { diff --git a/tests/test_cargo_bench.rs b/tests/test_cargo_bench.rs index 5fec4ec07..67a72b195 100644 --- a/tests/test_cargo_bench.rs +++ b/tests/test_cargo_bench.rs @@ -38,7 +38,7 @@ test!(cargo_bench_simple { assert_that(p.process(cargo_dir().join("cargo")).arg("bench"), execs().with_stdout(format!("\ {} foo v0.5.0 ({}) -{} target[..]release[..]foo +{} target[..]release[..]foo-[..] running 1 test test bench_hello ... bench: 0 ns/iter (+/- 0) @@ -175,7 +175,7 @@ test!(cargo_bench_failing_test { assert_that(p.process(cargo_dir().join("cargo")).arg("bench"), execs().with_stdout(format!("\ {} foo v0.5.0 ({}) -{} target[..]release[..]foo +{} target[..]release[..]foo-[..] running 1 test test bench_hello ... ", @@ -233,7 +233,7 @@ test bin_bench ... bench: 0 ns/iter (+/- 0) test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured -{running} target[..]release[..]foo +{running} target[..]release[..]foo-[..] running 1 test test lib_bench ... bench: 0 ns/iter (+/- 0) @@ -426,7 +426,7 @@ test!(pass_through_command_line { execs().with_status(0) .with_stdout(format!("\ {compiling} foo v0.0.1 ({dir}) -{running} target[..]release[..]foo +{running} target[..]release[..]foo-[..] running 1 test test bar ... bench: 0 ns/iter (+/- 0) @@ -441,7 +441,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured execs().with_status(0) .with_stdout(format!("\ {compiling} foo v0.0.1 ({dir}) -{running} target[..]release[..]foo +{running} target[..]release[..]foo-[..] running 1 test test foo ... bench: 0 ns/iter (+/- 0) diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 2e1774553..11c50b20f 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -216,7 +216,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package { .with_stderr("\ [..]warning: function is never used: `dead`[..] [..]fn dead() {} - +[..]^~~~~~~~~~~~ ")); assert_that(&p.bin("foo"), existing_file()); diff --git a/tests/test_cargo_compile_old_custom_build.rs b/tests/test_cargo_compile_old_custom_build.rs index 321dd8167..63a8081f2 100644 --- a/tests/test_cargo_compile_old_custom_build.rs +++ b/tests/test_cargo_compile_old_custom_build.rs @@ -149,7 +149,7 @@ test!(old_custom_build_failure { assert_that(p.cargo_process("build"), execs().with_status(101).with_stderr(format!("\ warning: the old build command has been deprecated\n\ -Failed to run custom build command for `foo v0.5.0 ({dir}) +Failed to run custom build command for `foo v0.5.0 ({dir})` Process didn't exit successfully: `{}` (status=101)\n\ --- stderr\n\ task '
' panicked at 'nope', {filename}:2\n\ @@ -213,7 +213,7 @@ test!(old_custom_second_build_failure { assert_that(p.cargo_process("build"), execs().with_status(101).with_stderr(format!("\ warning: the old build command has been deprecated\n\ -Failed to run custom build command for `foo v0.5.0 ({dir}) +Failed to run custom build command for `foo v0.5.0 ({dir})` Process didn't exit successfully: `{}` (status=101)\n\ --- stderr\n\ task '
' panicked at 'nope', {filename}:2\n\ diff --git a/tests/test_cargo_publish.rs b/tests/test_cargo_publish.rs index bf291d6fb..bca369b67 100644 --- a/tests/test_cargo_publish.rs +++ b/tests/test_cargo_publish.rs @@ -90,7 +90,7 @@ test!(git_deps { assert_that(p.cargo_process("publish").arg("-v").arg("--no-verify"), execs().with_status(101).with_stderr("\ -all dependencies must come from the same registry +all dependencies must come from the same registry. dependency `foo` comes from git://path/to/nowhere instead ")); }) @@ -118,7 +118,7 @@ test!(path_dependency_no_version { assert_that(p.cargo_process("publish"), execs().with_status(101).with_stderr("\ all path dependencies must have a version specified when being uploaded \ -to the registry +to the registry. dependency `bar` does not specify a version ")); }) diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index 450ae4f1a..3b25ae453 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -36,7 +36,7 @@ test!(cargo_test_simple { assert_that(p.process(cargo_dir().join("cargo")).arg("test"), execs().with_stdout(format!("\ {} foo v0.5.0 ({}) -{} target[..]foo +{} target[..]foo-[..] running 1 test test test_hello ... ok @@ -127,7 +127,7 @@ test!(cargo_test_failing_test { assert_that(p.process(cargo_dir().join("cargo")).arg("test"), execs().with_stdout(format!("\ {} foo v0.5.0 ({}) -{} target[..]foo +{} target[..]foo-[..] running 1 test test test_hello ... FAILED @@ -198,7 +198,7 @@ test bin_test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{running} target[..]foo +{running} target[..]foo[..] running 1 test test lib_test ... ok @@ -413,7 +413,7 @@ test!(pass_through_command_line { execs().with_status(0) .with_stdout(format!("\ {compiling} foo v0.0.1 ({dir}) -{running} target[..]foo +{running} target[..]foo-[..] running 1 test test bar ... ok @@ -435,7 +435,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured execs().with_status(0) .with_stdout(format!("\ {compiling} foo v0.0.1 ({dir}) -{running} target[..]foo +{running} target[..]foo-[..] running 1 test test foo ... ok