Fix lines_match test for matching process output

This commit is contained in:
Alex Crichton 2014-10-31 11:17:29 -07:00
parent 87ad4426dd
commit 4358288600
6 changed files with 17 additions and 17 deletions

View file

@ -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<T, I1, I2> {

View file

@ -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)

View file

@ -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());

View file

@ -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 '<main>' 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 '<main>' panicked at 'nope', {filename}:2\n\

View file

@ -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
"));
})

View file

@ -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