mirror of
https://github.com/rust-lang/cargo
synced 2024-10-02 05:53:53 +00:00
Fix lines_match test for matching process output
This commit is contained in:
parent
87ad4426dd
commit
4358288600
|
@ -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> {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -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
|
||||
"));
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue