remove useless formats

This commit is contained in:
Aleksey Kladov 2016-05-12 20:06:36 +03:00
parent fee4308bed
commit ac3a8579db
30 changed files with 421 additions and 423 deletions

View file

@ -12,8 +12,8 @@ fn assert_not_a_cargo_toml(command: &str, manifest_path_argument: &str) {
.arg("--manifest-path").arg(manifest_path_argument) .arg("--manifest-path").arg(manifest_path_argument)
.cwd(p.root().parent().unwrap()), .cwd(p.root().parent().unwrap()),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] the manifest-path must be a path \ .with_stderr("[ERROR] the manifest-path must be a path \
to a Cargo.toml file"))); to a Cargo.toml file"));
} }
#[allow(deprecated)] // connect => join in 1.3 #[allow(deprecated)] // connect => join in 1.3

View file

@ -102,11 +102,11 @@ test!(find_closest_biuld_to_build {
assert_that(pr, assert_that(pr,
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] no such subcommand .with_stderr("[ERROR] no such subcommand
<tab>Did you mean `build`? <tab>Did you mean `build`?
"))); "));
}); });
// if a subcommand is more than 3 edit distance away, we don't make a suggestion // if a subcommand is more than 3 edit distance away, we don't make a suggestion
@ -117,8 +117,8 @@ test!(find_closest_dont_correct_nonsense {
assert_that(pr, assert_that(pr,
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] no such subcommand .with_stderr("[ERROR] no such subcommand
"))); "));
}); });
test!(override_cargo_home { test!(override_cargo_home {

View file

@ -460,7 +460,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
assert_that(p.cargo("bench").arg("foo"), assert_that(p.cargo("bench").arg("foo"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[RUNNING] target[..]release[..]foo-[..] [RUNNING] target[..]release[..]foo-[..]
running 1 test running 1 test
@ -468,7 +468,7 @@ test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
"))); "));
}); });
// Regression test for running cargo-bench twice with // Regression test for running cargo-bench twice with
@ -776,7 +776,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
assert_that(p.cargo("bench"), assert_that(p.cargo("bench"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[RUNNING] target[..]release[..]foo-[..] [RUNNING] target[..]release[..]foo-[..]
running 1 test running 1 test
@ -784,7 +784,7 @@ test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
"))); "));
}); });
test!(bench_with_examples { test!(bench_with_examples {
@ -893,7 +893,7 @@ test!(test_a_bench {
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.1.0 ([..]) [COMPILING] foo v0.1.0 ([..])
[RUNNING] target[..]debug[..]b-[..] [RUNNING] target[..]debug[..]b-[..]
@ -902,7 +902,7 @@ test foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
test!(test_bench_no_run { test!(test_bench_no_run {
@ -929,9 +929,9 @@ test!(test_bench_no_run {
assert_that(p.cargo_process("bench").arg("--no-run"), assert_that(p.cargo_process("bench").arg("--no-run"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.1.0 ([..]) [COMPILING] foo v0.1.0 ([..])
"))); "));
}); });
test!(test_bench_multiple_packages { test!(test_bench_multiple_packages {
@ -1001,20 +1001,20 @@ test!(test_bench_multiple_packages {
assert_that(p.cargo_process("bench").arg("-p").arg("bar").arg("-p").arg("baz"), assert_that(p.cargo_process("bench").arg("-p").arg("bar").arg("-p").arg("baz"),
execs().with_status(0) execs().with_status(0)
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] target[..]release[..]bbaz-[..] [RUNNING] target[..]release[..]bbaz-[..]
running 1 test running 1 test
test bench_baz ... bench: 0 ns/iter (+/- 0) test bench_baz ... bench: 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
")) ")
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] target[..]release[..]bbar-[..] [RUNNING] target[..]release[..]bbar-[..]
running 1 test running 1 test
test bench_bar ... bench: 0 ns/iter (+/- 0) test bench_bar ... bench: 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
"))); "));
}); });

View file

@ -48,7 +48,7 @@ test!(build_with_no_lib {
assert_that(p.cargo_process("build").arg("--lib"), assert_that(p.cargo_process("build").arg("--lib"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] no library targets found"))); .with_stderr("[ERROR] no library targets found"));
}); });
test!(build_with_relative_cargo_home_path { test!(build_with_relative_cargo_home_path {

View file

@ -184,9 +184,9 @@ test!(dont_include {
"#) "#)
.file("b/src/lib.rs", ""); .file("b/src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] a v0.0.1 ([..]) [COMPILING] a v0.0.1 ([..])
"))); "));
}); });
test!(works_through_the_registry { test!(works_through_the_registry {
@ -211,14 +211,14 @@ test!(works_through_the_registry {
.file("src/lib.rs", "extern crate bar;"); .file("src/lib.rs", "extern crate bar;");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry [..] [UPDATING] registry [..]
[DOWNLOADING] [..] [DOWNLOADING] [..]
[DOWNLOADING] [..] [DOWNLOADING] [..]
[COMPILING] foo v0.1.0 ([..]) [COMPILING] foo v0.1.0 ([..])
[COMPILING] bar v0.1.0 ([..]) [COMPILING] bar v0.1.0 ([..])
[COMPILING] a v0.0.1 ([..]) [COMPILING] a v0.0.1 ([..])
"))); "));
}); });
test!(bad_target_spec { test!(bad_target_spec {
@ -235,7 +235,7 @@ test!(bad_target_spec {
.file("src/lib.rs", ""); .file("src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
@ -243,7 +243,7 @@ Caused by:
Caused by: Caused by:
unexpected character in cfg `4`, [..] unexpected character in cfg `4`, [..]
"))); "));
}); });
test!(bad_target_spec2 { test!(bad_target_spec2 {
@ -260,7 +260,7 @@ test!(bad_target_spec2 {
.file("src/lib.rs", ""); .file("src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
@ -268,7 +268,7 @@ Caused by:
Caused by: Caused by:
expected a string, found nothing expected a string, found nothing
"))); "));
}); });
test!(multiple_match_ok { test!(multiple_match_ok {

View file

@ -127,9 +127,9 @@ test!(clean_release {
assert_that(p.cargo("clean").arg("-p").arg("foo").arg("--release"), assert_that(p.cargo("clean").arg("-p").arg("foo").arg("--release"),
execs().with_status(0)); execs().with_status(0));
assert_that(p.cargo("build").arg("--release"), assert_that(p.cargo("build").arg("--release"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
"))); "));
}); });
test!(build_script { test!(build_script {
@ -163,12 +163,12 @@ test!(build_script {
assert_that(p.cargo("clean").arg("-p").arg("foo"), assert_that(p.cargo("clean").arg("-p").arg("foo"),
execs().with_status(0)); execs().with_status(0));
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc build.rs [..]` [RUNNING] `rustc build.rs [..]`
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]main.rs [..]` [RUNNING] `rustc src[..]main.rs [..]`
"))); "));
}); });
test!(clean_git { test!(clean_git {

View file

@ -43,12 +43,12 @@ test!(cargo_compile_with_invalid_manifest {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
no `package` or `project` section found. no `package` or `project` section found.
"))) "))
}); });
test!(cargo_compile_with_invalid_manifest2 { test!(cargo_compile_with_invalid_manifest2 {
@ -61,14 +61,14 @@ test!(cargo_compile_with_invalid_manifest2 {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
could not parse input as TOML could not parse input as TOML
Cargo.toml:3:19-3:20 expected a value Cargo.toml:3:19-3:20 expected a value
"))) "))
}); });
test!(cargo_compile_with_invalid_manifest3 { test!(cargo_compile_with_invalid_manifest3 {
@ -85,12 +85,12 @@ test!(cargo_compile_with_invalid_manifest3 {
.arg("src/Cargo.toml"), .arg("src/Cargo.toml"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
could not parse input as TOML\n\ could not parse input as TOML\n\
src[..]Cargo.toml:1:5-1:6 expected a value\n\n"))) src[..]Cargo.toml:1:5-1:6 expected a value\n\n"))
}); });
test!(cargo_compile_with_invalid_version { test!(cargo_compile_with_invalid_version {
@ -105,12 +105,12 @@ test!(cargo_compile_with_invalid_version {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
cannot parse '1.0' as a semver for the key `project.version` cannot parse '1.0' as a semver for the key `project.version`
"))) "))
}); });
@ -126,12 +126,12 @@ test!(cargo_compile_with_invalid_package_name {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
package name cannot be an empty string. package name cannot be an empty string.
"))) "))
}); });
test!(cargo_compile_with_invalid_bin_target_name { test!(cargo_compile_with_invalid_bin_target_name {
@ -149,12 +149,12 @@ test!(cargo_compile_with_invalid_bin_target_name {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
binary target names cannot be empty. binary target names cannot be empty.
"))) "))
}); });
test!(cargo_compile_with_forbidden_bin_target_name { test!(cargo_compile_with_forbidden_bin_target_name {
@ -172,12 +172,12 @@ test!(cargo_compile_with_forbidden_bin_target_name {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
the binary target name `build` is forbidden the binary target name `build` is forbidden
"))) "))
}); });
test!(cargo_compile_with_invalid_lib_target_name { test!(cargo_compile_with_invalid_lib_target_name {
@ -195,12 +195,12 @@ test!(cargo_compile_with_invalid_lib_target_name {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
library target names cannot be empty. library target names cannot be empty.
"))) "))
}); });
test!(cargo_compile_without_manifest { test!(cargo_compile_without_manifest {
@ -209,9 +209,9 @@ test!(cargo_compile_without_manifest {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] could not find `Cargo.toml` in `[..]` or any parent directory [ERROR] could not find `Cargo.toml` in `[..]` or any parent directory
"))); "));
}); });
test!(cargo_compile_with_invalid_code { test!(cargo_compile_with_invalid_code {
@ -227,10 +227,10 @@ src[..]foo.rs:1:1: 1:8 error: expected item[..]found `invalid`
src[..]foo.rs:1 invalid rust code! src[..]foo.rs:1 invalid rust code!
^~~~~~~ ^~~~~~~
") ")
.with_stderr_contains(format!("\ .with_stderr_contains("\
[ERROR] Could not compile `foo`. [ERROR] Could not compile `foo`.
To learn more, run the command again with --verbose.\n"))); To learn more, run the command again with --verbose.\n"));
assert_that(&p.root().join("Cargo.lock"), existing_file()); assert_that(&p.root().join("Cargo.lock"), existing_file());
}); });
@ -630,24 +630,24 @@ test!(cargo_compile_with_filename{
"#); "#);
assert_that(p.cargo_process("build").arg("--bin").arg("bin.rs"), assert_that(p.cargo_process("build").arg("--bin").arg("bin.rs"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no bin target named `bin.rs`"))); [ERROR] no bin target named `bin.rs`"));
assert_that(p.cargo_process("build").arg("--bin").arg("a.rs"), assert_that(p.cargo_process("build").arg("--bin").arg("a.rs"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no bin target named `a.rs` [ERROR] no bin target named `a.rs`
Did you mean `a`?"))); Did you mean `a`?"));
assert_that(p.cargo_process("build").arg("--example").arg("example.rs"), assert_that(p.cargo_process("build").arg("--example").arg("example.rs"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no example target named `example.rs`"))); [ERROR] no example target named `example.rs`"));
assert_that(p.cargo_process("build").arg("--example").arg("a.rs"), assert_that(p.cargo_process("build").arg("--example").arg("a.rs"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no example target named `a.rs` [ERROR] no example target named `a.rs`
Did you mean `a`?"))); Did you mean `a`?"));
}); });
test!(compile_path_dep_then_change_version { test!(compile_path_dep_then_change_version {
@ -680,13 +680,13 @@ test!(compile_path_dep_then_change_version {
"#).unwrap(); "#).unwrap();
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no matching package named `bar` found (required by `foo`) [ERROR] no matching package named `bar` found (required by `foo`)
location searched: [..] location searched: [..]
version required: = 0.0.1 version required: = 0.0.1
versions found: 0.0.2 versions found: 0.0.2
consider running `cargo update` to update a path dependency's locked version consider running `cargo update` to update a path dependency's locked version
"))); "));
}); });
test!(ignores_carriage_return_in_lockfile { test!(ignores_carriage_return_in_lockfile {
@ -805,7 +805,7 @@ test!(crate_authors_env_vars {
println!("bin"); println!("bin");
assert_that(process(&p.bin("foo")), assert_that(process(&p.bin("foo")),
execs().with_stdout(&format!("wycats@example.com:neikos@example.com"))); execs().with_stdout("wycats@example.com:neikos@example.com"));
println!("test"); println!("test");
assert_that(p.cargo("test").arg("-v"), assert_that(p.cargo("test").arg("-v"),
@ -935,9 +935,9 @@ test!(self_dependency {
.file("src/test.rs", "fn main() {}"); .file("src/test.rs", "fn main() {}");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] cyclic package dependency: package `test v0.0.0 ([..])` depends on itself [ERROR] cyclic package dependency: package `test v0.0.0 ([..])` depends on itself
"))); "));
}); });
test!(ignore_broken_symlinks { test!(ignore_broken_symlinks {
@ -968,12 +968,12 @@ test!(missing_lib_and_bin {
"#); "#);
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]Cargo.toml` [ERROR] failed to parse manifest at `[..]Cargo.toml`
Caused by: Caused by:
no targets specified in the manifest no targets specified in the manifest
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n"))); either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n"));
}); });
test!(lto_build { test!(lto_build {
@ -1546,7 +1546,7 @@ test!(bad_cargo_config {
this is not valid toml this is not valid toml
"#); "#);
assert_that(foo.cargo_process("build").arg("-v"), assert_that(foo.cargo_process("build").arg("-v"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] Couldn't load Cargo configuration [ERROR] Couldn't load Cargo configuration
Caused by: Caused by:
@ -1556,7 +1556,7 @@ Caused by:
could not parse input as TOML could not parse input as TOML
[..].cargo[..]config:2:20-2:21 expected `=`, but found `i` [..].cargo[..]config:2:20-2:21 expected `=`, but found `i`
"))); "));
}); });
test!(cargo_platform_specific_dependency { test!(cargo_platform_specific_dependency {
@ -1769,7 +1769,7 @@ test!(transitive_dependencies_not_available {
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101) execs().with_status(101)
.with_stderr(format!("\ .with_stderr("\
[..] can't find crate for `bbbbb`[..] [..] can't find crate for `bbbbb`[..]
[..] extern crate bbbbb; [..] [..] extern crate bbbbb; [..]
[..] [..]
@ -1778,7 +1778,7 @@ error: aborting due to previous error
Caused by: Caused by:
[..] [..]
"))); "));
}); });
test!(cyclic_deps_rejected { test!(cyclic_deps_rejected {
@ -1806,9 +1806,9 @@ test!(cyclic_deps_rejected {
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] cyclic package dependency: package `foo v0.0.1 ([..])` depends on itself [ERROR] cyclic package dependency: package `foo v0.0.1 ([..])` depends on itself
"))); "));
}); });
test!(predictable_filenames { test!(predictable_filenames {
@ -1882,12 +1882,12 @@ test!(rustc_env_var {
assert_that(p.cargo("build") assert_that(p.cargo("build")
.env("RUSTC", "rustc-that-does-not-exist").arg("-v"), .env("RUSTC", "rustc-that-does-not-exist").arg("-v"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] Could not execute process `rustc-that-does-not-exist -vV` ([..]) [ERROR] Could not execute process `rustc-that-does-not-exist -vV` ([..])
Caused by: Caused by:
[..] [..]
"))); "));
assert_that(&p.bin("a"), is_not(existing_file())); assert_that(&p.bin("a"), is_not(existing_file()));
}); });

View file

@ -203,10 +203,10 @@ test!(links_no_build_cmd {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] package `foo v0.5.0 (file://[..])` specifies that it links to `a` but does \ [ERROR] package `foo v0.5.0 (file://[..])` specifies that it links to `a` but does \
not have a custom build script not have a custom build script
"))); "));
}); });
test!(links_duplicates { test!(links_duplicates {
@ -237,13 +237,13 @@ test!(links_duplicates {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] native library `a` is being linked to by more than one package, and can only be \ [ERROR] native library `a` is being linked to by more than one package, and can only be \
linked to by one package linked to by one package
[..] v0.5.0 (file://[..]) [..] v0.5.0 (file://[..])
[..] v0.5.0 (file://[..]) [..] v0.5.0 (file://[..])
"))); "));
}); });
test!(overrides_and_links { test!(overrides_and_links {
@ -289,14 +289,14 @@ test!(overrides_and_links {
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[..] [..]
[..] [..]
[..] [..]
[..] [..]
[..] [..]
[RUNNING] `rustc [..] --crate-name foo [..] -L foo -L bar[..]` [RUNNING] `rustc [..] --crate-name foo [..] -L foo -L bar[..]`
"))); "));
}); });
test!(unused_overrides { test!(unused_overrides {
@ -386,11 +386,11 @@ test!(only_rerun_build_script {
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..]` [RUNNING] `rustc [..] --crate-name foo [..]`
"))); "));
}); });
test!(rebuild_continues_to_pass_env_vars { test!(rebuild_continues_to_pass_env_vars {
@ -470,7 +470,7 @@ test!(testing_and_such {
println!("test"); println!("test");
assert_that(p.cargo("test").arg("-vj1"), assert_that(p.cargo("test").arg("-vj1"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..]` [RUNNING] `rustc [..] --crate-name foo [..]`
@ -488,25 +488,25 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"))); "));
println!("doc"); println!("doc");
assert_that(p.cargo("doc").arg("-v"), assert_that(p.cargo("doc").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[DOCUMENTING] foo v0.5.0 (file://[..]) [DOCUMENTING] foo v0.5.0 (file://[..])
[RUNNING] `rustdoc [..]` [RUNNING] `rustdoc [..]`
"))); "));
File::create(&p.root().join("src/main.rs")).unwrap() File::create(&p.root().join("src/main.rs")).unwrap()
.write_all(b"fn main() {}").unwrap(); .write_all(b"fn main() {}").unwrap();
println!("run"); println!("run");
assert_that(p.cargo("run"), assert_that(p.cargo("run"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `target[..]foo[..]` [RUNNING] `target[..]foo[..]`
"))); "));
}); });
test!(propagation_of_l_flags { test!(propagation_of_l_flags {
@ -555,11 +555,11 @@ test!(propagation_of_l_flags {
assert_that(p.cargo_process("build").arg("-v").arg("-j1"), assert_that(p.cargo_process("build").arg("-v").arg("-j1"),
execs().with_status(0) execs().with_status(0)
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]` [RUNNING] `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name foo [..] -L bar -L foo` [RUNNING] `rustc [..] --crate-name foo [..] -L bar -L foo`
"))); "));
}); });
test!(propagation_of_l_flags_new { test!(propagation_of_l_flags_new {
@ -608,11 +608,11 @@ test!(propagation_of_l_flags_new {
assert_that(p.cargo_process("build").arg("-v").arg("-j1"), assert_that(p.cargo_process("build").arg("-v").arg("-j1"),
execs().with_status(0) execs().with_status(0)
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]` [RUNNING] `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name foo [..] -L bar -L foo` [RUNNING] `rustc [..] --crate-name foo [..] -L bar -L foo`
"))); "));
}); });
test!(build_deps_simple { test!(build_deps_simple {
@ -641,14 +641,14 @@ test!(build_deps_simple {
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] a v0.5.0 (file://[..]) [COMPILING] a v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name a [..]` [RUNNING] `rustc [..] --crate-name a [..]`
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc build.rs [..] --extern a=[..]` [RUNNING] `rustc build.rs [..] --extern a=[..]`
[RUNNING] `[..]foo-[..]build-script-build[..]` [RUNNING] `[..]foo-[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..]` [RUNNING] `rustc [..] --crate-name foo [..]`
"))); "));
}); });
test!(build_deps_not_for_normal { test!(build_deps_not_for_normal {
@ -678,7 +678,7 @@ test!(build_deps_not_for_normal {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target), assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[..]lib.rs[..] error: can't find crate for `aaaaa`[..] [..]lib.rs[..] error: can't find crate for `aaaaa`[..]
[..]lib.rs[..] extern crate aaaaa; [..]lib.rs[..] extern crate aaaaa;
[..] ^~~~~~~~~~~~~~~~~~~ [..] ^~~~~~~~~~~~~~~~~~~
@ -687,7 +687,7 @@ error: aborting due to previous error
Caused by: Caused by:
Process didn't exit successfully: [..] Process didn't exit successfully: [..]
"))); "));
}); });
test!(build_cmd_with_a_build_cmd { test!(build_cmd_with_a_build_cmd {
@ -729,7 +729,7 @@ test!(build_cmd_with_a_build_cmd {
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] b v0.5.0 (file://[..]) [COMPILING] b v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name b [..]` [RUNNING] `rustc [..] --crate-name b [..]`
[COMPILING] a v0.5.0 (file://[..]) [COMPILING] a v0.5.0 (file://[..])
@ -749,7 +749,7 @@ test!(build_cmd_with_a_build_cmd {
[RUNNING] `rustc [..]lib.rs --crate-name foo --crate-type lib -g \ [RUNNING] `rustc [..]lib.rs --crate-name foo --crate-type lib -g \
--out-dir [..]target[..]debug --emit=dep-info,link \ --out-dir [..]target[..]debug --emit=dep-info,link \
-L [..]target[..]debug -L [..]target[..]deps` -L [..]target[..]debug -L [..]target[..]deps`
"))); "));
}); });
test!(out_dir_is_preserved { test!(out_dir_is_preserved {
@ -818,12 +818,12 @@ test!(output_separate_lines {
"#); "#);
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101) execs().with_status(101)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc build.rs [..]` [RUNNING] `rustc build.rs [..]`
[RUNNING] `[..]foo-[..]build-script-build[..]` [RUNNING] `[..]foo-[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo` [RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo`
"))); "));
}); });
test!(output_separate_lines_new { test!(output_separate_lines_new {
@ -844,12 +844,12 @@ test!(output_separate_lines_new {
"#); "#);
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101) execs().with_status(101)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc build.rs [..]` [RUNNING] `rustc build.rs [..]`
[RUNNING] `[..]foo-[..]build-script-build[..]` [RUNNING] `[..]foo-[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo` [RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo`
"))); "));
}); });
#[cfg(not(windows))] // FIXME(#867) #[cfg(not(windows))] // FIXME(#867)
@ -887,11 +887,11 @@ test!(code_generation {
"#); "#);
assert_that(p.cargo_process("run"), assert_that(p.cargo_process("run"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..]) [COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `target[..]foo` [RUNNING] `target[..]foo`
Hello, World! Hello, World!
"))); "));
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_status(0)); execs().with_status(0));
@ -927,12 +927,12 @@ test!(build_script_only {
.file("build.rs", r#"fn main() {}"#); .file("build.rs", r#"fn main() {}"#);
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
no targets specified in the manifest no targets specified in the manifest
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present"))); either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present"));
}); });
test!(shared_dep_with_a_build_script { test!(shared_dep_with_a_build_script {
@ -1536,7 +1536,7 @@ test!(flags_go_into_tests {
"#); "#);
assert_that(p.cargo_process("test").arg("-v").arg("--test=foo"), assert_that(p.cargo_process("test").arg("-v").arg("--test=foo"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] a v0.5.0 ([..] [COMPILING] a v0.5.0 ([..]
[RUNNING] `rustc a[..]build.rs [..]` [RUNNING] `rustc a[..]build.rs [..]`
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
@ -1552,10 +1552,10 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"))); "));
assert_that(p.cargo("test").arg("-v").arg("-pb").arg("--lib"), assert_that(p.cargo("test").arg("-v").arg("-pb").arg("--lib"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[FRESH] a v0.5.0 ([..] [FRESH] a v0.5.0 ([..]
[COMPILING] b v0.5.0 ([..] [COMPILING] b v0.5.0 ([..]
[RUNNING] `rustc b[..]src[..]lib.rs [..] -L test[..]` [RUNNING] `rustc b[..]src[..]lib.rs [..] -L test[..]`
@ -1565,7 +1565,7 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
test!(diamond_passes_args_only_once { test!(diamond_passes_args_only_once {
@ -1616,7 +1616,7 @@ test!(diamond_passes_args_only_once {
.file("c/src/lib.rs", ""); .file("c/src/lib.rs", "");
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] c v0.5.0 ([..] [COMPILING] c v0.5.0 ([..]
[RUNNING] `rustc [..]` [RUNNING] `rustc [..]`
[RUNNING] `[..]` [RUNNING] `[..]`
@ -1627,7 +1627,7 @@ test!(diamond_passes_args_only_once {
[RUNNING] `rustc [..]` [RUNNING] `rustc [..]`
[COMPILING] foo v0.5.0 ([..] [COMPILING] foo v0.5.0 ([..]
[RUNNING] `[..]rlib -L native=test` [RUNNING] `[..]rlib -L native=test`
"))); "));
}); });
test!(adding_an_override_invalidates { test!(adding_an_override_invalidates {
@ -1650,12 +1650,12 @@ test!(adding_an_override_invalidates {
"#); "#);
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] foo v0.5.0 ([..] [COMPILING] foo v0.5.0 ([..]
[RUNNING] `rustc [..]` [RUNNING] `rustc [..]`
[RUNNING] `[..]` [RUNNING] `[..]`
[RUNNING] `rustc [..] -L native=foo` [RUNNING] `rustc [..] -L native=foo`
"))); "));
File::create(p.root().join(".cargo/config")).unwrap().write_all(format!(" File::create(p.root().join(".cargo/config")).unwrap().write_all(format!("
[target.{}.foo] [target.{}.foo]
@ -1663,10 +1663,10 @@ test!(adding_an_override_invalidates {
", target).as_bytes()).unwrap(); ", target).as_bytes()).unwrap();
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] foo v0.5.0 ([..] [COMPILING] foo v0.5.0 ([..]
[RUNNING] `rustc [..] -L native=bar` [RUNNING] `rustc [..] -L native=bar`
"))); "));
}); });
test!(changing_an_override_invalidates { test!(changing_an_override_invalidates {
@ -1688,10 +1688,10 @@ test!(changing_an_override_invalidates {
.file("build.rs", ""); .file("build.rs", "");
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] foo v0.5.0 ([..] [COMPILING] foo v0.5.0 ([..]
[RUNNING] `rustc [..] -L native=foo` [RUNNING] `rustc [..] -L native=foo`
"))); "));
File::create(p.root().join(".cargo/config")).unwrap().write_all(format!(" File::create(p.root().join(".cargo/config")).unwrap().write_all(format!("
[target.{}.foo] [target.{}.foo]
@ -1699,10 +1699,10 @@ test!(changing_an_override_invalidates {
", target).as_bytes()).unwrap(); ", target).as_bytes()).unwrap();
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] foo v0.5.0 ([..] [COMPILING] foo v0.5.0 ([..]
[RUNNING] `rustc [..] -L native=bar` [RUNNING] `rustc [..] -L native=bar`
"))); "));
}); });
test!(rebuild_only_on_explicit_paths { test!(rebuild_only_on_explicit_paths {
@ -1729,11 +1729,11 @@ test!(rebuild_only_on_explicit_paths {
// files don't exist, so should always rerun if they don't exist // files don't exist, so should always rerun if they don't exist
println!("run without"); println!("run without");
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] a v0.5.0 ([..]) [COMPILING] a v0.5.0 ([..])
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]` [RUNNING] `rustc src[..]lib.rs [..]`
"))); "));
::sleep_ms(1000); ::sleep_ms(1000);
File::create(p.root().join("foo")).unwrap(); File::create(p.root().join("foo")).unwrap();
@ -1742,17 +1742,17 @@ test!(rebuild_only_on_explicit_paths {
// now the exist, so run once, catch the mtime, then shouldn't run again // now the exist, so run once, catch the mtime, then shouldn't run again
println!("run with"); println!("run with");
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] a v0.5.0 ([..]) [COMPILING] a v0.5.0 ([..])
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]` [RUNNING] `rustc src[..]lib.rs [..]`
"))); "));
println!("run with2"); println!("run with2");
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[FRESH] a v0.5.0 ([..]) [FRESH] a v0.5.0 ([..])
"))); "));
::sleep_ms(1000); ::sleep_ms(1000);
@ -1760,29 +1760,29 @@ test!(rebuild_only_on_explicit_paths {
println!("run baz"); println!("run baz");
File::create(p.root().join("baz")).unwrap(); File::create(p.root().join("baz")).unwrap();
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[FRESH] a v0.5.0 ([..]) [FRESH] a v0.5.0 ([..])
"))); "));
// but changing dependent files does // but changing dependent files does
println!("run foo change"); println!("run foo change");
File::create(p.root().join("foo")).unwrap(); File::create(p.root().join("foo")).unwrap();
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] a v0.5.0 ([..]) [COMPILING] a v0.5.0 ([..])
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]` [RUNNING] `rustc src[..]lib.rs [..]`
"))); "));
// .. as does deleting a file // .. as does deleting a file
println!("run foo delete"); println!("run foo delete");
fs::remove_file(p.root().join("bar")).unwrap(); fs::remove_file(p.root().join("bar")).unwrap();
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] a v0.5.0 ([..]) [COMPILING] a v0.5.0 ([..])
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]` [RUNNING] `rustc src[..]lib.rs [..]`
"))); "));
}); });
@ -1814,9 +1814,9 @@ test!(doctest_recieves_build_link_args {
assert_that(p.cargo_process("test").arg("-v"), assert_that(p.cargo_process("test").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]` [RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`
"))); "));
}); });
test!(please_respect_the_dag { test!(please_respect_the_dag {
@ -1854,9 +1854,9 @@ test!(please_respect_the_dag {
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] `rustc [..] -L native=foo -L native=bar[..]` [RUNNING] `rustc [..] -L native=foo -L native=bar[..]`
"))); "));
}); });
test!(non_utf8_output { test!(non_utf8_output {

View file

@ -644,11 +644,11 @@ test!(update_with_shared_deps {
assert_that(p.cargo("update") assert_that(p.cargo("update")
.arg("-p").arg("bar") .arg("-p").arg("bar")
.arg("--precise").arg("0.1.2"), .arg("--precise").arg("0.1.2"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] Unable to update [..] [ERROR] Unable to update [..]
To learn more, run the command again with --verbose. To learn more, run the command again with --verbose.
"))); "));
// Specifying a precise rev to the old rev shouldn't actually update // Specifying a precise rev to the old rev shouldn't actually update
// anything because we already have the rev in the db. // anything because we already have the rev in the db.
@ -901,11 +901,11 @@ test!(dep_with_changed_submodule {
println!("first run"); println!("first run");
assert_that(project.cargo_process("run"), execs() assert_that(project.cargo_process("run"), execs()
.with_stdout(&format!("[UPDATING] git repository `[..]`\n\ .with_stdout("[UPDATING] git repository `[..]`\n\
[COMPILING] dep1 v0.5.0 ([..])\n\ [COMPILING] dep1 v0.5.0 ([..])\n\
[COMPILING] foo v0.5.0 ([..])\n\ [COMPILING] foo v0.5.0 ([..])\n\
[RUNNING] `target[..]foo[..]`\n\ [RUNNING] `target[..]foo[..]`\n\
project2")) project2")
.with_stderr("") .with_stderr("")
.with_status(0)); .with_status(0));
@ -943,11 +943,11 @@ test!(dep_with_changed_submodule {
println!("last run"); println!("last run");
assert_that(project.cargo("run"), execs() assert_that(project.cargo("run"), execs()
.with_stdout(&format!("[COMPILING] dep1 v0.5.0 ([..])\n\ .with_stdout("[COMPILING] dep1 v0.5.0 ([..])\n\
[COMPILING] foo v0.5.0 ([..])\n\ [COMPILING] foo v0.5.0 ([..])\n\
[RUNNING] `target[..]foo[..]`\n\ [RUNNING] `target[..]foo[..]`\n\
project3\ project3\
")) ")
.with_stderr("") .with_stderr("")
.with_status(0)); .with_status(0));
}); });
@ -998,7 +998,7 @@ test!(dev_deps_with_testing {
// Make sure we use the previous resolution of `bar` instead of updating it // Make sure we use the previous resolution of `bar` instead of updating it
// a second time. // a second time.
assert_that(p.cargo("test"), assert_that(p.cargo("test"),
execs().with_stdout(&format!("\ execs().with_stdout("\
[COMPILING] [..] v0.5.0 ([..]) [COMPILING] [..] v0.5.0 ([..])
[COMPILING] [..] v0.5.0 ([..] [COMPILING] [..] v0.5.0 ([..]
[RUNNING] target[..]foo-[..] [RUNNING] target[..]foo-[..]
@ -1008,7 +1008,7 @@ test tests::foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
test!(git_build_cmd_freshness { test!(git_build_cmd_freshness {
@ -1328,14 +1328,14 @@ test!(update_ambiguous {
assert_that(p.cargo("update") assert_that(p.cargo("update")
.arg("-p").arg("foo"), .arg("-p").arg("foo"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] There are multiple `foo` packages in your project, and the specification `foo` \ [ERROR] There are multiple `foo` packages in your project, and the specification `foo` \
is ambiguous. is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the \ Please re-run this command with `-p <spec>` where `<spec>` is one of the \
following: following:
foo:0.[..].0 foo:0.[..].0
foo:0.[..].0 foo:0.[..].0
"))); "));
}); });
test!(update_one_dep_in_repo_with_many_deps { test!(update_one_dep_in_repo_with_many_deps {
@ -1553,12 +1553,12 @@ test!(switch_sources {
p.build(); p.build();
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[UPDATING] git repository `file://[..]a1` [UPDATING] git repository `file://[..]a1`
[COMPILING] a v0.5.0 ([..]a1#[..] [COMPILING] a v0.5.0 ([..]a1#[..]
[COMPILING] b v0.5.0 ([..]) [COMPILING] b v0.5.0 ([..])
[COMPILING] project v0.5.0 ([..]) [COMPILING] project v0.5.0 ([..])
"))); "));
File::create(&p.root().join("b/Cargo.toml")).unwrap().write_all(format!(r#" File::create(&p.root().join("b/Cargo.toml")).unwrap().write_all(format!(r#"
[project] [project]
@ -1571,12 +1571,12 @@ test!(switch_sources {
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[UPDATING] git repository `file://[..]a2` [UPDATING] git repository `file://[..]a2`
[COMPILING] a v0.5.1 ([..]a2#[..] [COMPILING] a v0.5.1 ([..]a2#[..]
[COMPILING] b v0.5.0 ([..]) [COMPILING] b v0.5.0 ([..])
[COMPILING] project v0.5.0 ([..]) [COMPILING] project v0.5.0 ([..])
"))); "));
}); });
test!(dont_require_submodules_are_checked_out { test!(dont_require_submodules_are_checked_out {
@ -1677,11 +1677,11 @@ test!(lints_are_suppressed {
.file("src/lib.rs", ""); .file("src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] git repository `[..]` [UPDATING] git repository `[..]`
[COMPILING] a v0.5.0 ([..]) [COMPILING] a v0.5.0 ([..])
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
"))); "));
}); });
test!(denied_lints_are_allowed { test!(denied_lints_are_allowed {
@ -1714,11 +1714,11 @@ test!(denied_lints_are_allowed {
.file("src/lib.rs", ""); .file("src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] git repository `[..]` [UPDATING] git repository `[..]`
[COMPILING] a v0.5.0 ([..]) [COMPILING] a v0.5.0 ([..])
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
"))); "));
}); });
test!(add_a_git_dep { test!(add_a_git_dep {

View file

@ -174,7 +174,7 @@ test!(cargo_compile_with_root_dev_deps_with_testing {
p2.build(); p2.build();
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_stdout(&format!("\ execs().with_stdout("\
[COMPILING] [..] v0.5.0 ([..]) [COMPILING] [..] v0.5.0 ([..])
[COMPILING] [..] v0.5.0 ([..]) [COMPILING] [..] v0.5.0 ([..])
[RUNNING] target[..]foo-[..] [RUNNING] target[..]foo-[..]
@ -183,7 +183,7 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
test!(cargo_compile_with_transitive_dev_deps { test!(cargo_compile_with_transitive_dev_deps {
@ -509,7 +509,7 @@ test!(error_message_for_missing_manifest {
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] Unable to update file://[..] [ERROR] Unable to update file://[..]
Caused by: Caused by:
@ -517,7 +517,7 @@ Caused by:
Caused by: Caused by:
[..] (os error [..]) [..] (os error [..])
"))); "));
}); });
@ -783,18 +783,18 @@ test!(custom_target_no_rebuild {
p.build(); p.build();
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] a v0.5.0 ([..]) [COMPILING] a v0.5.0 ([..])
[COMPILING] foo v0.5.0 ([..]) [COMPILING] foo v0.5.0 ([..])
"))); "));
assert_that(p.cargo("build") assert_that(p.cargo("build")
.arg("--manifest-path=b/Cargo.toml") .arg("--manifest-path=b/Cargo.toml")
.env("CARGO_TARGET_DIR", "target"), .env("CARGO_TARGET_DIR", "target"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] b v0.5.0 ([..]) [COMPILING] b v0.5.0 ([..])
"))); "));
}); });
test!(override_and_depend { test!(override_and_depend {
@ -831,11 +831,11 @@ test!(override_and_depend {
p.build(); p.build();
assert_that(p.cargo("build").cwd(p.root().join("b")), assert_that(p.cargo("build").cwd(p.root().join("b")),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] a2 v0.5.0 ([..]) [COMPILING] a2 v0.5.0 ([..])
[COMPILING] a1 v0.5.0 ([..]) [COMPILING] a1 v0.5.0 ([..])
[COMPILING] b v0.5.0 ([..]) [COMPILING] b v0.5.0 ([..])
"))); "));
}); });
test!(missing_path_dependency { test!(missing_path_dependency {
@ -853,7 +853,7 @@ test!(missing_path_dependency {
p.build(); p.build();
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(101) execs().with_status(101)
.with_stderr(format!("\ .with_stderr("\
[ERROR] failed to update path override `[..]../whoa-this-does-not-exist` \ [ERROR] failed to update path override `[..]../whoa-this-does-not-exist` \
(defined in `[..]`) (defined in `[..]`)
@ -862,5 +862,5 @@ Caused by:
Caused by: Caused by:
[..] (os error [..]) [..] (os error [..])
"))); "));
}); });

View file

@ -262,8 +262,8 @@ test!(native_plugin_dependency_with_custom_ar_linker {
foo.build(); foo.build();
assert_that(bar.cargo_process("build").arg("--verbose"), assert_that(bar.cargo_process("build").arg("--verbose"),
execs().with_stdout(&format!("\ execs().with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]` [RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
"))); "));
}); });

View file

@ -117,9 +117,9 @@ test!(one_install_should_be_bad {
let a = a.join().unwrap(); let a = a.join().unwrap();
let (bad, good) = if a.status.code() == Some(101) {(a, b)} else {(b, a)}; let (bad, good) = if a.status.code() == Some(101) {(a, b)} else {(b, a)};
assert_that(bad, execs().with_status(101).with_stderr_contains(&format!("\ assert_that(bad, execs().with_status(101).with_stderr_contains("\
[ERROR] binary `foo[..]` already exists in destination as part of `[..]` [ERROR] binary `foo[..]` already exists in destination as part of `[..]`
"))); "));
assert_that(good, execs().with_status(0).with_stderr_contains("\ assert_that(good, execs().with_status(0).with_stderr_contains("\
warning: be sure to add `[..]` to your PATH [..] warning: be sure to add `[..]` to your PATH [..]
")); "));
@ -409,10 +409,10 @@ test!(debug_release_ok {
let b = b.wait_with_output().unwrap(); let b = b.wait_with_output().unwrap();
let a = a.join().unwrap(); let a = a.join().unwrap();
assert_that(a, execs().with_status(0).with_stdout(&format!("\ assert_that(a, execs().with_status(0).with_stdout("\
[COMPILING] foo v0.0.0 [..] [COMPILING] foo v0.0.0 [..]
"))); "));
assert_that(b, execs().with_status(0).with_stdout(&format!("\ assert_that(b, execs().with_status(0).with_stdout("\
[COMPILING] foo v0.0.0 [..] [COMPILING] foo v0.0.0 [..]
"))); "));
}); });

View file

@ -671,8 +671,8 @@ test!(build_script_needed_for_host_and_target {
.with_stdout_contains(&format!("\ .with_stdout_contains(&format!("\
[RUNNING] `{dir}[..]target[..]build[..]d1-[..]build-script-build`", [RUNNING] `{dir}[..]target[..]build[..]d1-[..]build-script-build`",
dir = p.root().display())) dir = p.root().display()))
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] `rustc d1[..]src[..]lib.rs [..]`")) [RUNNING] `rustc d1[..]src[..]lib.rs [..]`")
.with_stdout_contains(&format!("\ .with_stdout_contains(&format!("\
[COMPILING] d2 v0.0.0 ({url}/d2)", url = p.url())) [COMPILING] d2 v0.0.0 ({url}/d2)", url = p.url()))
.with_stdout_contains(&format!("\ .with_stdout_contains(&format!("\
@ -789,12 +789,12 @@ test!(plugin_build_script_right_arch {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(alternate()), assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(alternate()),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc build.rs [..]` [RUNNING] `rustc build.rs [..]`
[RUNNING] `[..]build-script-build[..]` [RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]` [RUNNING] `rustc src[..]lib.rs [..]`
"))); "));
}); });
test!(build_script_with_platform_specific_dependencies { test!(build_script_with_platform_specific_dependencies {
@ -888,7 +888,7 @@ test!(platform_specific_dependencies_do_not_leak {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target), assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
execs().with_status(101) execs().with_status(101)
.with_stderr(format!("\ .with_stderr("\
[..] error: can't find crate for `d2`[..] [..] error: can't find crate for `d2`[..]
[..] extern crate d2; [..] extern crate d2;
[..] [..]
@ -897,7 +897,7 @@ error: aborting due to previous error
Caused by: Caused by:
[..] [..]
"))); "));
}); });
test!(platform_specific_variables_reflected_in_build_scripts { test!(platform_specific_variables_reflected_in_build_scripts {

View file

@ -202,10 +202,10 @@ test!(doc_lib_bin_same_name {
assert_that(p.cargo_process("doc"), assert_that(p.cargo_process("doc"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] cannot document a package where a library and a binary have the same name. \ [ERROR] cannot document a package where a library and a binary have the same name. \
Consider renaming one or marking the target as `doc = false` Consider renaming one or marking the target as `doc = false`
"))); "));
}); });
test!(doc_dash_p { test!(doc_dash_p {
@ -240,11 +240,11 @@ test!(doc_dash_p {
assert_that(p.cargo_process("doc").arg("-p").arg("a"), assert_that(p.cargo_process("doc").arg("-p").arg("a"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[..] b v0.0.1 (file://[..]) [..] b v0.0.1 (file://[..])
[..] b v0.0.1 (file://[..]) [..] b v0.0.1 (file://[..])
[DOCUMENTING] a v0.0.1 (file://[..]) [DOCUMENTING] a v0.0.1 (file://[..])
"))); "));
}); });
test!(doc_same_name { test!(doc_same_name {
@ -426,10 +426,10 @@ test!(doc_release {
execs().with_status(0)); execs().with_status(0));
assert_that(p.cargo("doc").arg("--release").arg("-v"), assert_that(p.cargo("doc").arg("--release").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[DOCUMENTING] foo v0.0.1 ([..]) [DOCUMENTING] foo v0.0.1 ([..])
[RUNNING] `rustdoc src[..]lib.rs [..]` [RUNNING] `rustdoc src[..]lib.rs [..]`
"))); "));
}); });
test!(doc_multiple_deps { test!(doc_multiple_deps {

View file

@ -22,12 +22,12 @@ test!(invalid1 {
.file("src/main.rs", ""); .file("src/main.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
Feature `bar` includes `baz` which is neither a dependency nor another feature Feature `bar` includes `baz` which is neither a dependency nor another feature
"))); "));
}); });
test!(invalid2 { test!(invalid2 {
@ -47,12 +47,12 @@ test!(invalid2 {
.file("src/main.rs", ""); .file("src/main.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
Features and dependencies cannot have the same name: `bar` Features and dependencies cannot have the same name: `bar`
"))); "));
}); });
test!(invalid3 { test!(invalid3 {
@ -72,13 +72,13 @@ test!(invalid3 {
.file("src/main.rs", ""); .file("src/main.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
Feature `bar` depends on `baz` which is not an optional dependency. Feature `bar` depends on `baz` which is not an optional dependency.
Consider adding `optional = true` to the dependency Consider adding `optional = true` to the dependency
"))); "));
}); });
test!(invalid4 { test!(invalid4 {
@ -103,9 +103,9 @@ test!(invalid4 {
.file("bar/src/lib.rs", ""); .file("bar/src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] Package `bar v0.0.1 ([..])` does not have these features: `bar` [ERROR] Package `bar v0.0.1 ([..])` does not have these features: `bar`
"))); "));
let p = p.file("Cargo.toml", r#" let p = p.file("Cargo.toml", r#"
[project] [project]
@ -115,9 +115,9 @@ test!(invalid4 {
"#); "#);
assert_that(p.cargo_process("build").arg("--features").arg("test"), assert_that(p.cargo_process("build").arg("--features").arg("test"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] Package `foo v0.0.1 ([..])` does not have these features: `test` [ERROR] Package `foo v0.0.1 ([..])` does not have these features: `test`
"))); "));
}); });
test!(invalid5 { test!(invalid5 {
@ -135,12 +135,12 @@ test!(invalid5 {
.file("src/main.rs", ""); .file("src/main.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
Dev-dependencies are not allowed to be optional: `bar` Dev-dependencies are not allowed to be optional: `bar`
"))); "));
}); });
test!(invalid6 { test!(invalid6 {
@ -157,12 +157,12 @@ test!(invalid6 {
.file("src/main.rs", ""); .file("src/main.rs", "");
assert_that(p.cargo_process("build").arg("--features").arg("foo"), assert_that(p.cargo_process("build").arg("--features").arg("foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
Feature `foo` requires `bar` which is not an optional dependency Feature `foo` requires `bar` which is not an optional dependency
"))); "));
}); });
test!(invalid7 { test!(invalid7 {
@ -180,12 +180,12 @@ test!(invalid7 {
.file("src/main.rs", ""); .file("src/main.rs", "");
assert_that(p.cargo_process("build").arg("--features").arg("foo"), assert_that(p.cargo_process("build").arg("--features").arg("foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
Feature `foo` requires `bar` which is not an optional dependency Feature `foo` requires `bar` which is not an optional dependency
"))); "));
}); });
test!(invalid8 { test!(invalid8 {
@ -210,9 +210,9 @@ test!(invalid8 {
.file("bar/src/lib.rs", ""); .file("bar/src/lib.rs", "");
assert_that(p.cargo_process("build").arg("--features").arg("foo"), assert_that(p.cargo_process("build").arg("--features").arg("foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] features in dependencies cannot enable features in other dependencies: `foo/bar` [ERROR] features in dependencies cannot enable features in other dependencies: `foo/bar`
"))); "));
}); });
test!(no_feature_doesnt_build { test!(no_feature_doesnt_build {
@ -320,9 +320,9 @@ test!(cyclic_feature {
.file("src/main.rs", ""); .file("src/main.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] Cyclic feature dependency: feature `default` depends on itself [ERROR] Cyclic feature dependency: feature `default` depends on itself
"))); "));
}); });
test!(cyclic_feature2 { test!(cyclic_feature2 {
@ -340,9 +340,9 @@ test!(cyclic_feature2 {
.file("src/main.rs", ""); .file("src/main.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] Cyclic feature dependency: feature `[..]` depends on itself [ERROR] Cyclic feature dependency: feature `[..]` depends on itself
"))); "));
}); });
test!(groups_on_groups_on_groups { test!(groups_on_groups_on_groups {
@ -538,10 +538,10 @@ test!(many_features_no_rebuilds {
p.root().move_into_the_past().unwrap(); p.root().move_into_the_past().unwrap();
assert_that(p.cargo("build").arg("-v"), assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(format!("\ execs().with_status(0).with_stdout("\
[FRESH] a v0.1.0 ([..]/a) [FRESH] a v0.1.0 ([..]/a)
[FRESH] b v0.1.0 ([..]) [FRESH] b v0.1.0 ([..])
"))); "));
}); });
// Tests that all cmd lines work with `--features ""` // Tests that all cmd lines work with `--features ""`
@ -764,9 +764,9 @@ test!(optional_and_dev_dep {
.file("foo/src/lib.rs", ""); .file("foo/src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\ execs().with_status(0).with_stdout("\
[COMPILING] test v0.1.0 ([..]) [COMPILING] test v0.1.0 ([..])
"))); "));
}); });
test!(activating_feature_activates_dep { test!(activating_feature_activates_dep {

View file

@ -249,11 +249,11 @@ test!(no_rebuild_transitive_target_deps {
execs().with_status(0)); execs().with_status(0));
assert_that(p.cargo("test").arg("--no-run"), assert_that(p.cargo("test").arg("--no-run"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] c v0.0.1 ([..]) [COMPILING] c v0.0.1 ([..])
[COMPILING] b v0.0.1 ([..]) [COMPILING] b v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
"))); "));
}); });
test!(rerun_if_changed_in_dep { test!(rerun_if_changed_in_dep {

View file

@ -125,9 +125,9 @@ test!(confused_by_multiple_lib_files {
assert_that(cargo_process("init").arg("--vcs").arg("none") assert_that(cargo_process("init").arg("--vcs").arg("none")
.env("USER", "foo").cwd(&path), .env("USER", "foo").cwd(&path),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] cannot have a project with multiple libraries, found both `src/lib.rs` and `lib.rs` [ERROR] cannot have a project with multiple libraries, found both `src/lib.rs` and `lib.rs`
"))); "));
assert_that(&paths::root().join("foo/Cargo.toml"), is_not(existing_file())); assert_that(&paths::root().join("foo/Cargo.toml"), is_not(existing_file()));
}); });
@ -155,12 +155,12 @@ test!(multibin_project_name_clash {
assert_that(cargo_process("init").arg("--vcs").arg("none") assert_that(cargo_process("init").arg("--vcs").arg("none")
.env("USER", "foo").cwd(&path), .env("USER", "foo").cwd(&path),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] multiple possible binary sources found: [ERROR] multiple possible binary sources found:
main.rs main.rs
foo.rs foo.rs
cannot automatically generate Cargo.toml as the main target would be ambiguous cannot automatically generate Cargo.toml as the main target would be ambiguous
"))); "));
assert_that(&paths::root().join("foo/Cargo.toml"), is_not(existing_file())); assert_that(&paths::root().join("foo/Cargo.toml"), is_not(existing_file()));
}); });
@ -228,10 +228,10 @@ test!(invalid_dir_name {
fs::create_dir_all(&foo).unwrap(); fs::create_dir_all(&foo).unwrap();
assert_that(cargo_process("init").cwd(foo.clone()) assert_that(cargo_process("init").cwd(foo.clone())
.env("USER", "foo"), .env("USER", "foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] Invalid character `.` in crate name: `foo.bar` [ERROR] Invalid character `.` in crate name: `foo.bar`
use --name to override crate name use --name to override crate name
"))); "));
assert_that(&foo.join("Cargo.toml"), is_not(existing_file())); assert_that(&foo.join("Cargo.toml"), is_not(existing_file()));
}); });
@ -241,10 +241,10 @@ test!(reserved_name {
fs::create_dir_all(&test).unwrap(); fs::create_dir_all(&test).unwrap();
assert_that(cargo_process("init").cwd(test.clone()) assert_that(cargo_process("init").cwd(test.clone())
.env("USER", "foo"), .env("USER", "foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] The name `test` cannot be used as a crate name\n\ [ERROR] The name `test` cannot be used as a crate name\n\
use --name to override crate name use --name to override crate name
"))); "));
assert_that(&test.join("Cargo.toml"), is_not(existing_file())); assert_that(&test.join("Cargo.toml"), is_not(existing_file()));
}); });
@ -370,13 +370,13 @@ test!(with_argument {
test!(unknown_flags { test!(unknown_flags {
assert_that(cargo_process("init").arg("foo").arg("--flag"), assert_that(cargo_process("init").arg("foo").arg("--flag"),
execs().with_status(1) execs().with_status(1)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] Unknown flag: '--flag' [ERROR] Unknown flag: '--flag'
Usage: Usage:
cargo init [options] [<path>] cargo init [options] [<path>]
cargo init -h | --help cargo init -h | --help
"))); "));
}); });
#[cfg(not(windows))] #[cfg(not(windows))]

View file

@ -95,22 +95,22 @@ test!(pick_max_version {
test!(missing { test!(missing {
pkg("foo", "0.0.1"); pkg("foo", "0.0.1");
assert_that(cargo_process("install").arg("bar"), assert_that(cargo_process("install").arg("bar"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] could not find `bar` in `registry file://[..]` [ERROR] could not find `bar` in `registry file://[..]`
"))); "));
}); });
test!(bad_version { test!(bad_version {
pkg("foo", "0.0.1"); pkg("foo", "0.0.1");
assert_that(cargo_process("install").arg("foo").arg("--vers=0.2.0"), assert_that(cargo_process("install").arg("foo").arg("--vers=0.2.0"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] could not find `foo` in `registry file://[..]` with version `0.2.0` [ERROR] could not find `foo` in `registry file://[..]` with version `0.2.0`
"))); "));
}); });
test!(no_crate { test!(no_crate {
assert_that(cargo_process("install"), assert_that(cargo_process("install"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] `[..]` is not a crate root; specify a crate to install [..] [ERROR] `[..]` is not a crate root; specify a crate to install [..]
Caused by: Caused by:
@ -118,7 +118,7 @@ Caused by:
Caused by: Caused by:
[..] (os error [..]) [..] (os error [..])
"))); "));
}); });
test!(install_location_precedence { test!(install_location_precedence {
@ -184,10 +184,10 @@ test!(install_path {
execs().with_status(0)); execs().with_status(0));
assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(cargo_process("install").arg("--path").arg(".").cwd(p.root()), assert_that(cargo_process("install").arg("--path").arg(".").cwd(p.root()),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] binary `foo[..]` already exists in destination as part of `foo v0.1.0 [..]` [ERROR] binary `foo[..]` already exists in destination as part of `foo v0.1.0 [..]`
Add --force to overwrite Add --force to overwrite
"))); "));
}); });
test!(multiple_crates_error { test!(multiple_crates_error {
@ -209,9 +209,9 @@ test!(multiple_crates_error {
p.build(); p.build();
assert_that(cargo_process("install").arg("--git").arg(p.url().to_string()), assert_that(cargo_process("install").arg("--git").arg(p.url().to_string()),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] multiple packages with binaries found: bar, foo [ERROR] multiple packages with binaries found: bar, foo
"))); "));
}); });
test!(multiple_crates_select { test!(multiple_crates_select {
@ -324,9 +324,9 @@ test!(no_binaries_or_examples {
p.build(); p.build();
assert_that(cargo_process("install").arg("--path").arg(p.root()), assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no packages found with binaries or examples [ERROR] no packages found with binaries or examples
"))); "));
}); });
test!(no_binaries { test!(no_binaries {
@ -342,9 +342,9 @@ test!(no_binaries {
p.build(); p.build();
assert_that(cargo_process("install").arg("--path").arg(p.root()).arg("foo"), assert_that(cargo_process("install").arg("--path").arg(p.root()).arg("foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] specified package has no binaries [ERROR] specified package has no binaries
"))); "));
}); });
test!(examples { test!(examples {
@ -380,11 +380,11 @@ test!(install_twice {
assert_that(cargo_process("install").arg("--path").arg(p.root()), assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(0)); execs().with_status(0));
assert_that(cargo_process("install").arg("--path").arg(p.root()), assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] binary `foo-bin1[..]` already exists in destination as part of `foo v0.1.0 ([..])` [ERROR] binary `foo-bin1[..]` already exists in destination as part of `foo v0.1.0 ([..])`
binary `foo-bin2[..]` already exists in destination as part of `foo v0.1.0 ([..])` binary `foo-bin2[..]` already exists in destination as part of `foo v0.1.0 ([..])`
Add --force to overwrite Add --force to overwrite
"))); "));
}); });
test!(install_force { test!(install_force {
@ -527,7 +527,7 @@ test!(compile_failure {
p.build(); p.build();
assert_that(cargo_process("install").arg("--path").arg(p.root()), assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
error: main function not found error: main function not found
error: aborting due to previous error error: aborting due to previous error
[ERROR] failed to compile `foo v0.1.0 (file://[..])`, intermediate artifacts can be \ [ERROR] failed to compile `foo v0.1.0 (file://[..])`, intermediate artifacts can be \
@ -537,7 +537,7 @@ Caused by:
Could not compile `foo`. Could not compile `foo`.
To learn more, run the command again with --verbose. To learn more, run the command again with --verbose.
"))); "));
}); });
test!(git_repo { test!(git_repo {
@ -585,9 +585,9 @@ foo v0.0.1 (registry [..]):
test!(uninstall_pkg_does_not_exist { test!(uninstall_pkg_does_not_exist {
assert_that(cargo_process("uninstall").arg("foo"), assert_that(cargo_process("uninstall").arg("foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] package id specification `foo` matched no packages [ERROR] package id specification `foo` matched no packages
"))); "));
}); });
test!(uninstall_bin_does_not_exist { test!(uninstall_bin_does_not_exist {
@ -596,9 +596,9 @@ test!(uninstall_bin_does_not_exist {
assert_that(cargo_process("install").arg("foo"), assert_that(cargo_process("install").arg("foo"),
execs().with_status(0)); execs().with_status(0));
assert_that(cargo_process("uninstall").arg("foo").arg("--bin=bar"), assert_that(cargo_process("uninstall").arg("foo").arg("--bin=bar"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] binary `bar[..]` not installed as part of `foo v0.0.1 ([..])` [ERROR] binary `bar[..]` not installed as part of `foo v0.0.1 ([..])`
"))); "));
}); });
test!(uninstall_piecemeal { test!(uninstall_piecemeal {
@ -633,9 +633,9 @@ test!(uninstall_piecemeal {
assert_that(cargo_home(), is_not(has_installed_exe("foo"))); assert_that(cargo_home(), is_not(has_installed_exe("foo")));
assert_that(cargo_process("uninstall").arg("foo"), assert_that(cargo_process("uninstall").arg("foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] package id specification `foo` matched no packages [ERROR] package id specification `foo` matched no packages
"))); "));
}); });
test!(subcommand_works_out_of_the_box { test!(subcommand_works_out_of_the_box {

View file

@ -177,11 +177,11 @@ test!(cargo_metadata_with_invalid_manifest {
.file("Cargo.toml", ""); .file("Cargo.toml", "");
assert_that(p.cargo_process("metadata"), execs().with_status(101) assert_that(p.cargo_process("metadata"), execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
no `package` or `project` section found."))) no `package` or `project` section found."))
}); });
const MANIFEST_OUTPUT: &'static str= const MANIFEST_OUTPUT: &'static str=
@ -238,8 +238,8 @@ test!(cargo_metadata_no_deps_path_to_cargo_toml_parent_relative {
.arg("--manifest-path").arg("foo") .arg("--manifest-path").arg("foo")
.cwd(p.root().parent().unwrap()), .cwd(p.root().parent().unwrap()),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] the manifest-path must be \ .with_stderr("[ERROR] the manifest-path must be \
a path to a Cargo.toml file"))); a path to a Cargo.toml file"));
}); });
test!(cargo_metadata_no_deps_path_to_cargo_toml_parent_absolute { test!(cargo_metadata_no_deps_path_to_cargo_toml_parent_absolute {
@ -251,8 +251,8 @@ test!(cargo_metadata_no_deps_path_to_cargo_toml_parent_absolute {
.arg("--manifest-path").arg(p.root()) .arg("--manifest-path").arg(p.root())
.cwd(p.root().parent().unwrap()), .cwd(p.root().parent().unwrap()),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] the manifest-path must be \ .with_stderr("[ERROR] the manifest-path must be \
a path to a Cargo.toml file"))); a path to a Cargo.toml file"));
}); });
test!(cargo_metadata_no_deps_cwd { test!(cargo_metadata_no_deps_cwd {

View file

@ -67,13 +67,13 @@ test!(simple_git {
test!(no_argument { test!(no_argument {
assert_that(cargo_process("new"), assert_that(cargo_process("new"),
execs().with_status(1) execs().with_status(1)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] Invalid arguments. [ERROR] Invalid arguments.
Usage: Usage:
cargo new [options] <path> cargo new [options] <path>
cargo new -h | --help cargo new -h | --help
"))); "));
}); });
test!(existing { test!(existing {
@ -88,17 +88,17 @@ test!(existing {
test!(invalid_characters { test!(invalid_characters {
assert_that(cargo_process("new").arg("foo.rs"), assert_that(cargo_process("new").arg("foo.rs"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] Invalid character `.` in crate name: `foo.rs` [ERROR] Invalid character `.` in crate name: `foo.rs`
use --name to override crate name"))); use --name to override crate name"));
}); });
test!(reserved_name { test!(reserved_name {
assert_that(cargo_process("new").arg("test"), assert_that(cargo_process("new").arg("test"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] The name `test` cannot be used as a crate name\n\ [ERROR] The name `test` cannot be used as a crate name\n\
use --name to override crate name"))); use --name to override crate name"));
}); });
test!(rust_prefix_stripped { test!(rust_prefix_stripped {
@ -281,11 +281,11 @@ test!(subpackage_git_with_vcs_arg {
test!(unknown_flags { test!(unknown_flags {
assert_that(cargo_process("new").arg("foo").arg("--flag"), assert_that(cargo_process("new").arg("foo").arg("--flag"),
execs().with_status(1) execs().with_status(1)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] Unknown flag: '--flag' [ERROR] Unknown flag: '--flag'
Usage: Usage:
cargo new [..] cargo new [..]
cargo new [..] cargo new [..]
"))); "));
}); });

View file

@ -41,12 +41,12 @@ test!(override_simple {
"); ");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]` [UPDATING] registry `file://[..]`
[UPDATING] git repository `[..]` [UPDATING] git repository `[..]`
[COMPILING] foo v0.1.0 (file://[..]) [COMPILING] foo v0.1.0 (file://[..])
[COMPILING] local v0.0.1 (file://[..]) [COMPILING] local v0.0.1 (file://[..])
"))); "));
}); });
test!(missing_version { test!(missing_version {
@ -135,14 +135,14 @@ test!(transitive {
.file("src/lib.rs", ""); .file("src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]` [UPDATING] registry `file://[..]`
[UPDATING] git repository `[..]` [UPDATING] git repository `[..]`
[DOWNLOADING] bar v0.2.0 (registry [..]) [DOWNLOADING] bar v0.2.0 (registry [..])
[COMPILING] foo v0.1.0 (file://[..]) [COMPILING] foo v0.1.0 (file://[..])
[COMPILING] bar v0.2.0 (registry [..]) [COMPILING] bar v0.2.0 (registry [..])
[COMPILING] local v0.0.1 (file://[..]) [COMPILING] local v0.0.1 (file://[..])
"))); "));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
}); });
@ -181,12 +181,12 @@ test!(persists_across_rebuilds {
"); ");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]` [UPDATING] registry `file://[..]`
[UPDATING] git repository `file://[..]` [UPDATING] git repository `file://[..]`
[COMPILING] foo v0.1.0 (file://[..]) [COMPILING] foo v0.1.0 (file://[..])
[COMPILING] local v0.0.1 (file://[..]) [COMPILING] local v0.0.1 (file://[..])
"))); "));
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(0).with_stdout("")); execs().with_status(0).with_stdout(""));
@ -226,11 +226,11 @@ test!(replace_registry_with_path {
"); ");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]` [UPDATING] registry `file://[..]`
[COMPILING] foo v0.1.0 (file://[..]) [COMPILING] foo v0.1.0 (file://[..])
[COMPILING] local v0.0.1 (file://[..]) [COMPILING] local v0.0.1 (file://[..])
"))); "));
}); });
test!(use_a_spec_to_select { test!(use_a_spec_to_select {
@ -281,7 +281,7 @@ test!(use_a_spec_to_select {
"); ");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]` [UPDATING] registry `file://[..]`
[UPDATING] git repository `[..]` [UPDATING] git repository `[..]`
[DOWNLOADING] [..] [DOWNLOADING] [..]
@ -290,7 +290,7 @@ test!(use_a_spec_to_select {
[COMPILING] [..] [COMPILING] [..]
[COMPILING] [..] [COMPILING] [..]
[COMPILING] local v0.0.1 (file://[..]) [COMPILING] local v0.0.1 (file://[..])
"))); "));
}); });
test!(override_adds_some_deps { test!(override_adds_some_deps {
@ -326,26 +326,26 @@ test!(override_adds_some_deps {
.file("src/lib.rs", ""); .file("src/lib.rs", "");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]` [UPDATING] registry `file://[..]`
[UPDATING] git repository `[..]` [UPDATING] git repository `[..]`
[DOWNLOADING] foo v0.1.1 (registry [..]) [DOWNLOADING] foo v0.1.1 (registry [..])
[COMPILING] foo v0.1.1 (registry [..]) [COMPILING] foo v0.1.1 (registry [..])
[COMPILING] bar v0.1.0 ([..]) [COMPILING] bar v0.1.0 ([..])
[COMPILING] local v0.0.1 (file://[..]) [COMPILING] local v0.0.1 (file://[..])
"))); "));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
Package::new("foo", "0.1.2").publish(); Package::new("foo", "0.1.2").publish();
assert_that(p.cargo("update").arg("-p").arg(&format!("{}#bar", foo.url())), assert_that(p.cargo("update").arg("-p").arg(&format!("{}#bar", foo.url())),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] git repository `file://[..]` [UPDATING] git repository `file://[..]`
"))); "));
assert_that(p.cargo("update").arg("-p").arg(&format!("{}#bar", registry())), assert_that(p.cargo("update").arg("-p").arg(&format!("{}#bar", registry())),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]` [UPDATING] registry `file://[..]`
"))); "));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
}); });

View file

@ -327,10 +327,10 @@ test!(no_duplicates_from_modified_tracked_files {
cargo.cwd(p.root()); cargo.cwd(p.root());
assert_that(cargo.clone().arg("build"), execs().with_status(0)); assert_that(cargo.clone().arg("build"), execs().with_status(0));
assert_that(cargo.arg("package").arg("--list"), assert_that(cargo.arg("package").arg("--list"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
Cargo.toml Cargo.toml
src/main.rs src/main.rs
"))); "));
}); });
test!(ignore_nested { test!(ignore_nested {
@ -399,11 +399,11 @@ test!(package_weird_characters {
.file("src/:foo", ""); .file("src/:foo", "");
assert_that(p.cargo_process("package"), assert_that(p.cargo_process("package"),
execs().with_status(101).with_stderr(format!("\ execs().with_status(101).with_stderr("\
warning: [..] warning: [..]
[ERROR] failed to prepare local package for uploading [ERROR] failed to prepare local package for uploading
Caused by: Caused by:
cannot package a filename with a special character `:`: src/:foo cannot package a filename with a special character `:`: src/:foo
"))); "));
}); });

View file

@ -99,10 +99,10 @@ test!(git_deps {
.file("src/main.rs", "fn main() {}"); .file("src/main.rs", "fn main() {}");
assert_that(p.cargo_process("publish").arg("-v").arg("--no-verify"), assert_that(p.cargo_process("publish").arg("-v").arg("--no-verify"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] all dependencies must come from the same source. [ERROR] all dependencies must come from the same source.
dependency `foo` comes from git://path/to/nowhere instead dependency `foo` comes from git://path/to/nowhere instead
"))); "));
}); });
test!(path_dependency_no_version { test!(path_dependency_no_version {
@ -128,10 +128,10 @@ test!(path_dependency_no_version {
.file("bar/src/lib.rs", ""); .file("bar/src/lib.rs", "");
assert_that(p.cargo_process("publish"), assert_that(p.cargo_process("publish"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] all path dependencies must have a version specified when publishing. [ERROR] all path dependencies must have a version specified when publishing.
dependency `bar` does not specify a version dependency `bar` does not specify a version
"))); "));
}); });
test!(unpublishable_crate { test!(unpublishable_crate {
@ -148,8 +148,8 @@ test!(unpublishable_crate {
.file("src/main.rs", "fn main() {}"); .file("src/main.rs", "fn main() {}");
assert_that(p.cargo_process("publish"), assert_that(p.cargo_process("publish"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] some crates cannot be published. [ERROR] some crates cannot be published.
`foo` is marked as unpublishable `foo` is marked as unpublishable
"))); "));
}); });

View file

@ -58,8 +58,8 @@ test!(cargo_read_manifest_path_to_cargo_toml_parent_relative {
.arg("--manifest-path").arg("foo") .arg("--manifest-path").arg("foo")
.cwd(p.root().parent().unwrap()), .cwd(p.root().parent().unwrap()),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] the manifest-path must be \ .with_stderr("[ERROR] the manifest-path must be \
a path to a Cargo.toml file"))); a path to a Cargo.toml file"));
}); });
test!(cargo_read_manifest_path_to_cargo_toml_parent_absolute { test!(cargo_read_manifest_path_to_cargo_toml_parent_absolute {
@ -71,8 +71,8 @@ test!(cargo_read_manifest_path_to_cargo_toml_parent_absolute {
.arg("--manifest-path").arg(p.root()) .arg("--manifest-path").arg(p.root())
.cwd(p.root().parent().unwrap()), .cwd(p.root().parent().unwrap()),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] the manifest-path must be \ .with_stderr("[ERROR] the manifest-path must be \
a path to a Cargo.toml file"))); a path to a Cargo.toml file"));
}); });
test!(cargo_read_manifest_cwd { test!(cargo_read_manifest_cwd {

View file

@ -92,11 +92,11 @@ test!(nonexistent {
.file("src/main.rs", "fn main() {}"); .file("src/main.rs", "fn main() {}");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no matching package named `nonexistent` found (required by `foo`) [ERROR] no matching package named `nonexistent` found (required by `foo`)
location searched: registry file://[..] location searched: registry file://[..]
version required: >= 0.0.0 version required: >= 0.0.0
"))); "));
}); });
test!(wrong_version { test!(wrong_version {
@ -116,23 +116,23 @@ test!(wrong_version {
Package::new("foo", "0.0.2").publish(); Package::new("foo", "0.0.2").publish();
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no matching package named `foo` found (required by `foo`) [ERROR] no matching package named `foo` found (required by `foo`)
location searched: registry file://[..] location searched: registry file://[..]
version required: >= 1.0.0 version required: >= 1.0.0
versions found: 0.0.2, 0.0.1 versions found: 0.0.2, 0.0.1
"))); "));
Package::new("foo", "0.0.3").publish(); Package::new("foo", "0.0.3").publish();
Package::new("foo", "0.0.4").publish(); Package::new("foo", "0.0.4").publish();
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no matching package named `foo` found (required by `foo`) [ERROR] no matching package named `foo` found (required by `foo`)
location searched: registry file://[..] location searched: registry file://[..]
version required: >= 1.0.0 version required: >= 1.0.0
versions found: 0.0.4, 0.0.3, 0.0.2, ... versions found: 0.0.4, 0.0.3, 0.0.2, ...
"))); "));
}); });
test!(bad_cksum { test!(bad_cksum {
@ -153,7 +153,7 @@ test!(bad_cksum {
File::create(&pkg.archive_dst()).unwrap(); File::create(&pkg.archive_dst()).unwrap();
assert_that(p.cargo_process("build").arg("-v"), assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] unable to get packages from source [ERROR] unable to get packages from source
Caused by: Caused by:
@ -161,7 +161,7 @@ Caused by:
Caused by: Caused by:
failed to verify the checksum of `bad-cksum v0.0.1 (registry file://[..])` failed to verify the checksum of `bad-cksum v0.0.1 (registry file://[..])`
"))); "));
}); });
test!(update_registry { test!(update_registry {
@ -180,11 +180,11 @@ test!(update_registry {
.file("src/main.rs", "fn main() {}"); .file("src/main.rs", "fn main() {}");
assert_that(p.cargo_process("build"), assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no matching package named `notyet` found (required by `foo`) [ERROR] no matching package named `notyet` found (required by `foo`)
location searched: registry file://[..] location searched: registry file://[..]
version required: >= 0.0.0 version required: >= 0.0.0
"))); "));
Package::new("notyet", "0.0.1").publish(); Package::new("notyet", "0.0.1").publish();
@ -227,14 +227,14 @@ test!(package_with_path_deps {
p.build(); p.build();
assert_that(p.cargo("package").arg("-v"), assert_that(p.cargo("package").arg("-v"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] failed to verify package tarball [ERROR] failed to verify package tarball
Caused by: Caused by:
no matching package named `notyet` found (required by `foo`) no matching package named `notyet` found (required by `foo`)
location searched: registry file://[..] location searched: registry file://[..]
version required: ^0.0.1 version required: ^0.0.1
"))); "));
Package::new("notyet", "0.0.1").publish(); Package::new("notyet", "0.0.1").publish();
@ -367,12 +367,12 @@ test!(relying_on_a_yank_is_bad {
Package::new("bar", "0.0.1").dep("baz", "=0.0.2").publish(); Package::new("bar", "0.0.1").dep("baz", "=0.0.2").publish();
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no matching package named `baz` found (required by `bar`) [ERROR] no matching package named `baz` found (required by `bar`)
location searched: registry file://[..] location searched: registry file://[..]
version required: = 0.0.2 version required: = 0.0.2
versions found: 0.0.1 versions found: 0.0.1
"))); "));
}); });
test!(yanks_in_lockfiles_are_ok { test!(yanks_in_lockfiles_are_ok {
@ -402,11 +402,11 @@ test!(yanks_in_lockfiles_are_ok {
execs().with_status(0).with_stdout("")); execs().with_status(0).with_stdout(""));
assert_that(p.cargo("update"), assert_that(p.cargo("update"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no matching package named `bar` found (required by `foo`) [ERROR] no matching package named `bar` found (required by `foo`)
location searched: registry file://[..] location searched: registry file://[..]
version required: * version required: *
"))); "));
}); });
test!(update_with_lockfile_if_packages_missing { test!(update_with_lockfile_if_packages_missing {
@ -430,10 +430,10 @@ test!(update_with_lockfile_if_packages_missing {
paths::home().join(".cargo/registry").rm_rf().unwrap(); paths::home().join(".cargo/registry").rm_rf().unwrap();
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
[DOWNLOADING] bar v0.0.1 (registry file://[..]) [DOWNLOADING] bar v0.0.1 (registry file://[..])
"))); "));
}); });
test!(update_lockfile { test!(update_lockfile {
@ -461,10 +461,10 @@ test!(update_lockfile {
println!("0.0.2 update"); println!("0.0.2 update");
assert_that(p.cargo("update") assert_that(p.cargo("update")
.arg("-p").arg("bar").arg("--precise").arg("0.0.2"), .arg("-p").arg("bar").arg("--precise").arg("0.0.2"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
[UPDATING] bar v0.0.1 (registry file://[..]) -> v0.0.2 [UPDATING] bar v0.0.1 (registry file://[..]) -> v0.0.2
"))); "));
println!("0.0.2 build"); println!("0.0.2 build");
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
@ -478,10 +478,10 @@ test!(update_lockfile {
println!("0.0.3 update"); println!("0.0.3 update");
assert_that(p.cargo("update") assert_that(p.cargo("update")
.arg("-p").arg("bar"), .arg("-p").arg("bar"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
[UPDATING] bar v0.0.2 (registry file://[..]) -> v0.0.3 [UPDATING] bar v0.0.2 (registry file://[..]) -> v0.0.3
"))); "));
println!("0.0.3 build"); println!("0.0.3 build");
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
@ -565,8 +565,8 @@ test!(bad_license_file {
"#); "#);
assert_that(p.cargo_process("publish").arg("-v"), assert_that(p.cargo_process("publish").arg("-v"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] the license file `foo` does not exist"))); [ERROR] the license file `foo` does not exist"));
}); });
test!(updating_a_dep { test!(updating_a_dep {
@ -735,10 +735,10 @@ test!(fetch_downloads {
assert_that(p.cargo("fetch"), assert_that(p.cargo("fetch"),
execs().with_status(0) execs().with_status(0)
.with_stdout(format!("\ .with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
[DOWNLOADING] a v0.1.0 (registry [..]) [DOWNLOADING] a v0.1.0 (registry [..])
"))); "));
}); });
test!(update_transitive_dependency { test!(update_transitive_dependency {
@ -765,19 +765,19 @@ test!(update_transitive_dependency {
assert_that(p.cargo("update").arg("-pb"), assert_that(p.cargo("update").arg("-pb"),
execs().with_status(0) execs().with_status(0)
.with_stdout(format!("\ .with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
[UPDATING] b v0.1.0 (registry [..]) -> v0.1.1 [UPDATING] b v0.1.0 (registry [..]) -> v0.1.1
"))); "));
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(0) execs().with_status(0)
.with_stdout(format!("\ .with_stdout("\
[DOWNLOADING] b v0.1.1 (registry file://[..]) [DOWNLOADING] b v0.1.1 (registry file://[..])
[COMPILING] b v0.1.1 (registry [..]) [COMPILING] b v0.1.1 (registry [..])
[COMPILING] a v0.1.0 (registry [..]) [COMPILING] a v0.1.0 (registry [..])
[COMPILING] foo v0.5.0 ([..]) [COMPILING] foo v0.5.0 ([..])
"))); "));
}); });
test!(update_backtracking_ok { test!(update_backtracking_ok {
@ -811,9 +811,9 @@ test!(update_backtracking_ok {
assert_that(p.cargo("update").arg("-p").arg("hyper"), assert_that(p.cargo("update").arg("-p").arg("hyper"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
"))); "));
}); });
test!(update_multiple_packages { test!(update_multiple_packages {
@ -845,35 +845,35 @@ test!(update_multiple_packages {
assert_that(p.cargo("update").arg("-pa").arg("-pb"), assert_that(p.cargo("update").arg("-pa").arg("-pb"),
execs().with_status(0) execs().with_status(0)
.with_stdout(format!("\ .with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
[UPDATING] a v0.1.0 (registry [..]) -> v0.1.1 [UPDATING] a v0.1.0 (registry [..]) -> v0.1.1
[UPDATING] b v0.1.0 (registry [..]) -> v0.1.1 [UPDATING] b v0.1.0 (registry [..]) -> v0.1.1
"))); "));
assert_that(p.cargo("update").arg("-pb").arg("-pc"), assert_that(p.cargo("update").arg("-pb").arg("-pc"),
execs().with_status(0) execs().with_status(0)
.with_stdout(format!("\ .with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
[UPDATING] c v0.1.0 (registry [..]) -> v0.1.1 [UPDATING] c v0.1.0 (registry [..]) -> v0.1.1
"))); "));
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(0) execs().with_status(0)
.with_stdout_contains(format!("\ .with_stdout_contains("\
[DOWNLOADING] a v0.1.1 (registry file://[..])")) [DOWNLOADING] a v0.1.1 (registry file://[..])")
.with_stdout_contains(format!("\ .with_stdout_contains("\
[DOWNLOADING] b v0.1.1 (registry file://[..])")) [DOWNLOADING] b v0.1.1 (registry file://[..])")
.with_stdout_contains(format!("\ .with_stdout_contains("\
[DOWNLOADING] c v0.1.1 (registry file://[..])")) [DOWNLOADING] c v0.1.1 (registry file://[..])")
.with_stdout_contains(format!("\ .with_stdout_contains("\
[COMPILING] a v0.1.1 (registry [..])")) [COMPILING] a v0.1.1 (registry [..])")
.with_stdout_contains(format!("\ .with_stdout_contains("\
[COMPILING] b v0.1.1 (registry [..])")) [COMPILING] b v0.1.1 (registry [..])")
.with_stdout_contains(format!("\ .with_stdout_contains("\
[COMPILING] c v0.1.1 (registry [..])")) [COMPILING] c v0.1.1 (registry [..])")
.with_stdout_contains(format!("\ .with_stdout_contains("\
[COMPILING] foo v0.5.0 ([..])"))); [COMPILING] foo v0.5.0 ([..])"));
}); });
test!(bundled_crate_in_registry { test!(bundled_crate_in_registry {
@ -982,12 +982,12 @@ test!(only_download_relevant {
Package::new("baz", "0.1.0").publish(); Package::new("baz", "0.1.0").publish();
assert_that(p.cargo("build"), assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
[DOWNLOADING] baz v0.1.0 ([..]) [DOWNLOADING] baz v0.1.0 ([..])
[COMPILING] baz v0.1.0 ([..]) [COMPILING] baz v0.1.0 ([..])
[COMPILING] bar v0.5.0 ([..]) [COMPILING] bar v0.5.0 ([..])
"))); "));
}); });
test!(resolve_and_backtracking { test!(resolve_and_backtracking {

View file

@ -61,9 +61,9 @@ test!(simple_quiet_and_verbose {
"#); "#);
assert_that(p.cargo_process("run").arg("-q").arg("-v"), assert_that(p.cargo_process("run").arg("-q").arg("-v"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] cannot set both --verbose and --quiet [ERROR] cannot set both --verbose and --quiet
"))); "));
}); });
test!(quiet_and_verbose_config { test!(quiet_and_verbose_config {
@ -119,9 +119,9 @@ test!(exit_code {
assert_that(p.cargo_process("run"), assert_that(p.cargo_process("run"),
execs().with_status(2) execs().with_status(2)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] Process didn't exit successfully: `target[..]foo[..]` (exit code: 2) [ERROR] Process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
"))); "));
}); });
test!(exit_code_verbose { test!(exit_code_verbose {
@ -138,9 +138,9 @@ test!(exit_code_verbose {
assert_that(p.cargo_process("run").arg("-v"), assert_that(p.cargo_process("run").arg("-v"),
execs().with_status(2) execs().with_status(2)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] Process didn't exit successfully: `target[..]foo[..]` (exit code: 2) [ERROR] Process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
"))); "));
}); });
test!(no_main_file { test!(no_main_file {
@ -155,8 +155,8 @@ test!(no_main_file {
assert_that(p.cargo_process("run"), assert_that(p.cargo_process("run"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] a bin target must be available \ .with_stderr("[ERROR] a bin target must be available \
for `cargo run`\n"))); for `cargo run`\n"));
}); });
test!(too_many_bins { test!(too_many_bins {
@ -173,9 +173,9 @@ test!(too_many_bins {
assert_that(p.cargo_process("run"), assert_that(p.cargo_process("run"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] `cargo run` requires that a project only \ .with_stderr("[ERROR] `cargo run` requires that a project only \
have one executable; use the `--bin` option \ have one executable; use the `--bin` option \
to specify which one to run\n"))); to specify which one to run\n"));
}); });
test!(specify_name { test!(specify_name {
@ -261,24 +261,24 @@ test!(run_with_filename {
"#); "#);
assert_that(p.cargo_process("run").arg("--bin").arg("bin.rs"), assert_that(p.cargo_process("run").arg("--bin").arg("bin.rs"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no bin target named `bin.rs`"))); [ERROR] no bin target named `bin.rs`"));
assert_that(p.cargo_process("run").arg("--bin").arg("a.rs"), assert_that(p.cargo_process("run").arg("--bin").arg("a.rs"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no bin target named `a.rs` [ERROR] no bin target named `a.rs`
Did you mean `a`?"))); Did you mean `a`?"));
assert_that(p.cargo_process("run").arg("--example").arg("example.rs"), assert_that(p.cargo_process("run").arg("--example").arg("example.rs"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no example target named `example.rs`"))); [ERROR] no example target named `example.rs`"));
assert_that(p.cargo_process("run").arg("--example").arg("a.rs"), assert_that(p.cargo_process("run").arg("--example").arg("a.rs"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no example target named `a.rs` [ERROR] no example target named `a.rs`
Did you mean `a`?"))); Did you mean `a`?"));
}); });
test!(either_name_or_example { test!(either_name_or_example {
@ -298,9 +298,9 @@ test!(either_name_or_example {
assert_that(p.cargo_process("run").arg("--bin").arg("a").arg("--example").arg("b"), assert_that(p.cargo_process("run").arg("--bin").arg("a").arg("--example").arg("b"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("[ERROR] `cargo run` can run at most one \ .with_stderr("[ERROR] `cargo run` can run at most one \
executable, but multiple were \ executable, but multiple were \
specified"))); specified"));
}); });
test!(one_bin_multiple_examples { test!(one_bin_multiple_examples {

View file

@ -7,11 +7,9 @@ use hamcrest::assert_that;
fn setup() { fn setup() {
} }
fn cargo_rustc_error() -> String { const CARGO_RUSTC_ERROR: &'static str =
format!("[ERROR] extra arguments to `rustc` can only be passed to one target, \ "[ERROR] extra arguments to `rustc` can only be passed to one target, consider filtering
consider filtering\nthe package by passing e.g. `--lib` or `--bin NAME` to \ the package by passing e.g. `--lib` or `--bin NAME` to specify a single target";
specify a single target")
}
test!(build_lib_for_foo { test!(build_lib_for_foo {
let p = project("foo") let p = project("foo")
@ -122,7 +120,7 @@ test!(fails_when_trying_to_build_main_and_lib_with_args {
.arg("--").arg("-Z").arg("unstable-options"), .arg("--").arg("-Z").arg("unstable-options"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&cargo_rustc_error())); .with_stderr(CARGO_RUSTC_ERROR));
}); });
test!(build_with_args_to_one_of_multiple_binaries { test!(build_with_args_to_one_of_multiple_binaries {
@ -181,7 +179,7 @@ test!(fails_with_args_to_all_binaries {
.arg("--").arg("-Z").arg("unstable-options"), .arg("--").arg("-Z").arg("unstable-options"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&cargo_rustc_error())); .with_stderr(CARGO_RUSTC_ERROR));
}); });
test!(build_with_args_to_one_of_multiple_tests { test!(build_with_args_to_one_of_multiple_tests {
@ -285,10 +283,10 @@ test!(build_only_bar_dependency {
.arg("--").arg("-Z").arg("unstable-options"), .arg("--").arg("-Z").arg("unstable-options"),
execs() execs()
.with_status(0) .with_status(0)
.with_stdout(format!("\ .with_stdout("\
[COMPILING] bar v0.1.0 ([..]) [COMPILING] bar v0.1.0 ([..])
[RUNNING] `[..]--crate-name bar --crate-type lib [..] -Z unstable-options [..]` [RUNNING] `[..]--crate-name bar --crate-type lib [..] -Z unstable-options [..]`
"))); "));
}); });
test!(fail_with_multiple_packages { test!(fail_with_multiple_packages {
@ -340,11 +338,11 @@ test!(fail_with_multiple_packages {
assert_that(foo.cargo("rustc").arg("-v").arg("-p").arg("bar") assert_that(foo.cargo("rustc").arg("-v").arg("-p").arg("bar")
.arg("-p").arg("baz"), .arg("-p").arg("baz"),
execs().with_status(1).with_stderr(format!("\ execs().with_status(1).with_stderr("\
[ERROR] Invalid arguments. [ERROR] Invalid arguments.
Usage: Usage:
cargo rustc [options] [--] [<opts>...]"))); cargo rustc [options] [--] [<opts>...]"));
}); });
test!(rustc_with_other_profile { test!(rustc_with_other_profile {

View file

@ -161,7 +161,7 @@ test!(rustdoc_same_name_err {
.arg("--").arg("--no-defaults"), .arg("--").arg("--no-defaults"),
execs() execs()
.with_status(101) .with_status(101)
.with_stderr(&format!("[ERROR] cannot document a package where a library and a \ .with_stderr("[ERROR] cannot document a package where a library and a \
binary have the same name. Consider renaming one \ binary have the same name. Consider renaming one \
or marking the target as `doc = false`"))); or marking the target as `doc = false`"));
}); });

View file

@ -80,9 +80,9 @@ test!(simple {
} }
assert_that(cargo_process("search").arg("postgres"), assert_that(cargo_process("search").arg("postgres"),
execs().with_status(0).with_stdout(format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
hoare (0.1.1) Design by contract style assertions for Rust"))); hoare (0.1.1) Design by contract style assertions for Rust"));
}); });
test!(multiple_query_params { test!(multiple_query_params {
@ -126,9 +126,9 @@ test!(multiple_query_params {
} }
assert_that(cargo_process("search").arg("postgres").arg("sql"), assert_that(cargo_process("search").arg("postgres").arg("sql"),
execs().with_status(0).with_stdout(format!("\ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]` [UPDATING] registry `[..]`
hoare (0.1.1) Design by contract style assertions for Rust"))); hoare (0.1.1) Design by contract style assertions for Rust"));
}); });
test!(help { test!(help {

View file

@ -480,7 +480,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
assert_that(p.cargo("test").arg("foo"), assert_that(p.cargo("test").arg("foo"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[RUNNING] target[..]foo-[..] [RUNNING] target[..]foo-[..]
running 1 test running 1 test
@ -494,7 +494,7 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
// Regression test for running cargo-test twice with // Regression test for running cargo-test twice with
@ -726,11 +726,11 @@ test!(bin_without_name {
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
binary target bin.name is required"))); binary target bin.name is required"));
}); });
test!(bench_without_name { test!(bench_without_name {
@ -770,11 +770,11 @@ test!(bench_without_name {
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
bench target bench.name is required"))); bench target bench.name is required"));
}); });
test!(test_without_name { test!(test_without_name {
@ -813,11 +813,11 @@ test!(test_without_name {
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
test target test.name is required"))); test target test.name is required"));
}); });
test!(example_without_name { test!(example_without_name {
@ -856,11 +856,11 @@ test!(example_without_name {
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_status(101) execs().with_status(101)
.with_stderr(&format!("\ .with_stderr("\
[ERROR] failed to parse manifest at `[..]` [ERROR] failed to parse manifest at `[..]`
Caused by: Caused by:
example target example.name is required"))); example target example.name is required"));
}); });
test!(bin_there_for_integration { test!(bin_there_for_integration {
@ -957,7 +957,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
p.root().move_into_the_past().unwrap(); p.root().move_into_the_past().unwrap();
assert_that(p.cargo("test"), assert_that(p.cargo("test"),
execs().with_status(0) execs().with_status(0)
.with_stdout(format!("\ .with_stdout("\
[RUNNING] target[..]foo-[..] [RUNNING] target[..]foo-[..]
running 1 test running 1 test
@ -972,7 +972,7 @@ test foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
@ -1013,7 +1013,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
assert_that(p.cargo("test"), assert_that(p.cargo("test"),
execs().with_status(0) execs().with_status(0)
.with_stdout(format!("\ .with_stdout("\
[RUNNING] target[..]foo-[..] [RUNNING] target[..]foo-[..]
running 1 test running 1 test
@ -1027,7 +1027,7 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
test!(test_then_build { test!(test_then_build {
@ -1471,11 +1471,11 @@ test!(example_bin_same_name {
assert_that(p.cargo("run"), assert_that(p.cargo("run"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[RUNNING] [..] [RUNNING] [..]
bin bin
"))); "));
assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("foo"), existing_file());
}); });
@ -1528,13 +1528,13 @@ test!(example_with_dev_dep {
assert_that(p.cargo_process("test").arg("-v"), assert_that(p.cargo_process("test").arg("-v"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[..] [..]
[..] [..]
[..] [..]
[..] [..]
[RUNNING] `rustc [..] --crate-name ex [..] --extern a=[..]` [RUNNING] `rustc [..] --crate-name ex [..] --extern a=[..]`
"))); "));
}); });
test!(bin_is_preserved { test!(bin_is_preserved {
@ -1569,13 +1569,13 @@ test!(bad_example {
.file("src/lib.rs", ""); .file("src/lib.rs", "");
assert_that(p.cargo_process("run").arg("--example").arg("foo"), assert_that(p.cargo_process("run").arg("--example").arg("foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no example target named `foo` [ERROR] no example target named `foo`
"))); "));
assert_that(p.cargo_process("run").arg("--bin").arg("foo"), assert_that(p.cargo_process("run").arg("--bin").arg("foo"),
execs().with_status(101).with_stderr(&format!("\ execs().with_status(101).with_stderr("\
[ERROR] no bin target named `foo` [ERROR] no bin target named `foo`
"))); "));
}); });
test!(doctest_feature { test!(doctest_feature {
@ -1597,7 +1597,7 @@ test!(doctest_feature {
"#); "#);
assert_that(p.cargo_process("test").arg("--features").arg("bar"), assert_that(p.cargo_process("test").arg("--features").arg("bar"),
execs().with_status(0).with_stdout(format!("\ execs().with_status(0).with_stdout("\
[COMPILING] foo [..] [COMPILING] foo [..]
[RUNNING] target[..]foo[..] [RUNNING] target[..]foo[..]
@ -1612,7 +1612,7 @@ test foo_0 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"))) "))
}); });
test!(dashes_to_underscores { test!(dashes_to_underscores {
@ -1680,7 +1680,7 @@ test!(filter_no_doc_tests {
.file("tests/foo.rs", ""); .file("tests/foo.rs", "");
assert_that(p.cargo_process("test").arg("--test=foo"), assert_that(p.cargo_process("test").arg("--test=foo"),
execs().with_stdout(format!("\ execs().with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[RUNNING] target[..]debug[..]foo[..] [RUNNING] target[..]debug[..]foo[..]
@ -1688,7 +1688,7 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
test!(dylib_doctest { test!(dylib_doctest {
@ -1712,7 +1712,7 @@ test!(dylib_doctest {
"#); "#);
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_stdout(format!("\ execs().with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[DOCTEST] foo [DOCTEST] foo
@ -1721,7 +1721,7 @@ test foo_0 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
test!(dylib_doctest2 { test!(dylib_doctest2 {
@ -1778,7 +1778,7 @@ test!(cyclic_dev_dep_doc_test {
extern crate foo; extern crate foo;
"#); "#);
assert_that(p.cargo_process("test"), assert_that(p.cargo_process("test"),
execs().with_stdout(format!("\ execs().with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[COMPILING] bar v0.0.1 ([..]) [COMPILING] bar v0.0.1 ([..])
[RUNNING] target[..]foo[..] [RUNNING] target[..]foo[..]
@ -1794,7 +1794,7 @@ test _0 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"))) "))
}); });
test!(dev_dep_with_build_script { test!(dev_dep_with_build_script {
@ -1869,7 +1869,7 @@ test!(no_fail_fast {
"#); "#);
assert_that(p.cargo_process("test").arg("--no-fail-fast"), assert_that(p.cargo_process("test").arg("--no-fail-fast"),
execs().with_status(101) execs().with_status(101)
.with_stdout_contains(format!("\ .with_stdout_contains("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[RUNNING] target[..]foo[..] [RUNNING] target[..]foo[..]
@ -1878,8 +1878,8 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
[RUNNING] target[..]test_add_one[..] [RUNNING] target[..]test_add_one[..]
")) ")
.with_stdout_contains(format!("\ .with_stdout_contains("\
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured
[RUNNING] target[..]test_sub_one[..] [RUNNING] target[..]test_sub_one[..]
@ -1896,7 +1896,7 @@ test sub_one_0 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"))) "))
}); });
test!(test_multiple_packages { test!(test_multiple_packages {
@ -1943,20 +1943,20 @@ test!(test_multiple_packages {
assert_that(p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"), assert_that(p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"),
execs().with_status(0) execs().with_status(0)
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] target[..]debug[..]d1-[..] [RUNNING] target[..]debug[..]d1-[..]
running 0 tests running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
")) ")
.with_stdout_contains(&format!("\ .with_stdout_contains("\
[RUNNING] target[..]debug[..]d2-[..] [RUNNING] target[..]debug[..]d2-[..]
running 0 tests running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"))); "));
}); });
test!(bin_does_not_rebuild_tests { test!(bin_does_not_rebuild_tests {
@ -1981,11 +1981,11 @@ test!(bin_does_not_rebuild_tests {
assert_that(p.cargo("test").arg("-v").arg("--no-run"), assert_that(p.cargo("test").arg("-v").arg("--no-run"),
execs().with_status(0) execs().with_status(0)
.with_stdout(&format!("\ .with_stdout("\
[COMPILING] foo v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc src[..]main.rs [..]` [RUNNING] `rustc src[..]main.rs [..]`
[RUNNING] `rustc src[..]main.rs [..]` [RUNNING] `rustc src[..]main.rs [..]`
"))); "));
}); });
test!(selective_test_wonky_profile { test!(selective_test_wonky_profile {
@ -2040,11 +2040,11 @@ test!(selective_test_optional_dep {
assert_that(p.cargo("test").arg("-v").arg("--no-run") assert_that(p.cargo("test").arg("-v").arg("--no-run")
.arg("--features").arg("a").arg("-p").arg("a"), .arg("--features").arg("a").arg("-p").arg("a"),
execs().with_status(0).with_stdout(&format!("\ execs().with_status(0).with_stdout("\
[COMPILING] a v0.0.1 ([..]) [COMPILING] a v0.0.1 ([..])
[RUNNING] `rustc a[..]src[..]lib.rs [..]` [RUNNING] `rustc a[..]src[..]lib.rs [..]`
[RUNNING] `rustc a[..]src[..]lib.rs [..]` [RUNNING] `rustc a[..]src[..]lib.rs [..]`
"))); "));
}); });
test!(only_test_docs { test!(only_test_docs {