.arg("--manifest-path").arg(manifest_path_argument)
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("[ERROR] the manifest-path must be a path \
- to a Cargo.toml file")));
+ .with_stderr("[ERROR] the manifest-path must be a path \
+ to a Cargo.toml file"));
}
#[allow(deprecated)] // connect => join in 1.3
assert_that(pr,
execs().with_status(101)
- .with_stderr(&format!("[ERROR] no such subcommand
+ .with_stderr("[ERROR] no such subcommand
<tab>Did you mean `build`?
-")));
+"));
});
// if a subcommand is more than 3 edit distance away, we don't make a suggestion
assert_that(pr,
execs().with_status(101)
- .with_stderr(&format!("[ERROR] no such subcommand
-")));
+ .with_stderr("[ERROR] no such subcommand
+"));
});
test!(override_cargo_home {
assert_that(p.cargo("bench").arg("foo"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[RUNNING] target[..]release[..]foo-[..]
running 1 test
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-")));
+"));
});
// Regression test for running cargo-bench twice with
assert_that(p.cargo("bench"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[RUNNING] target[..]release[..]foo-[..]
running 1 test
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-")));
+"));
});
test!(bench_with_examples {
assert_that(p.cargo_process("test"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.1.0 ([..])
[RUNNING] target[..]debug[..]b-[..]
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
test!(test_bench_no_run {
assert_that(p.cargo_process("bench").arg("--no-run"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.1.0 ([..])
-")));
+"));
});
test!(test_bench_multiple_packages {
assert_that(p.cargo_process("bench").arg("-p").arg("bar").arg("-p").arg("baz"),
execs().with_status(0)
- .with_stdout_contains(&format!("\
+ .with_stdout_contains("\
[RUNNING] target[..]release[..]bbaz-[..]
running 1 test
test bench_baz ... bench: 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-"))
- .with_stdout_contains(&format!("\
+")
+ .with_stdout_contains("\
[RUNNING] target[..]release[..]bbar-[..]
running 1 test
test bench_bar ... bench: 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-")));
+"));
});
assert_that(p.cargo_process("build").arg("--lib"),
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 {
"#)
.file("b/src/lib.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[COMPILING] a v0.0.1 ([..])
-")));
+"));
});
test!(works_through_the_registry {
.file("src/lib.rs", "extern crate bar;");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry [..]
[DOWNLOADING] [..]
[DOWNLOADING] [..]
[COMPILING] foo v0.1.0 ([..])
[COMPILING] bar v0.1.0 ([..])
[COMPILING] a v0.0.1 ([..])
-")));
+"));
});
test!(bad_target_spec {
.file("src/lib.rs", "");
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 `[..]`
Caused by:
Caused by:
unexpected character in cfg `4`, [..]
-")));
+"));
});
test!(bad_target_spec2 {
.file("src/lib.rs", "");
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 `[..]`
Caused by:
Caused by:
expected a string, found nothing
-")));
+"));
});
test!(multiple_match_ok {
assert_that(p.cargo("clean").arg("-p").arg("foo").arg("--release"),
execs().with_status(0));
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 ([..])
-")));
+"));
});
test!(build_script {
assert_that(p.cargo("clean").arg("-p").arg("foo"),
execs().with_status(0));
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 ([..])
[RUNNING] `rustc build.rs [..]`
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]main.rs [..]`
-")));
+"));
});
test!(clean_git {
assert_that(p.cargo_process("build"),
execs()
.with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
no `package` or `project` section found.
-")))
+"))
});
test!(cargo_compile_with_invalid_manifest2 {
assert_that(p.cargo_process("build"),
execs()
.with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
could not parse input as TOML
Cargo.toml:3:19-3:20 expected a value
-")))
+"))
});
test!(cargo_compile_with_invalid_manifest3 {
.arg("src/Cargo.toml"),
execs()
.with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
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 {
assert_that(p.cargo_process("build"),
execs()
.with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
cannot parse '1.0' as a semver for the key `project.version`
-")))
+"))
});
assert_that(p.cargo_process("build"),
execs()
.with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
package name cannot be an empty string.
-")))
+"))
});
test!(cargo_compile_with_invalid_bin_target_name {
assert_that(p.cargo_process("build"),
execs()
.with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
binary target names cannot be empty.
-")))
+"))
});
test!(cargo_compile_with_forbidden_bin_target_name {
assert_that(p.cargo_process("build"),
execs()
.with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
the binary target name `build` is forbidden
-")))
+"))
});
test!(cargo_compile_with_invalid_lib_target_name {
assert_that(p.cargo_process("build"),
execs()
.with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
library target names cannot be empty.
-")))
+"))
});
test!(cargo_compile_without_manifest {
assert_that(p.cargo_process("build"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] could not find `Cargo.toml` in `[..]` or any parent directory
-")));
+"));
});
test!(cargo_compile_with_invalid_code {
src[..]foo.rs:1 invalid rust code!
^~~~~~~
")
- .with_stderr_contains(format!("\
+ .with_stderr_contains("\
[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.cargo_process("build").arg("--bin").arg("bin.rs"),
- execs().with_status(101).with_stderr(&format!("\
-[ERROR] no bin target named `bin.rs`")));
+ execs().with_status(101).with_stderr("\
+[ERROR] no bin target named `bin.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`
-Did you mean `a`?")));
+Did you mean `a`?"));
assert_that(p.cargo_process("build").arg("--example").arg("example.rs"),
- execs().with_status(101).with_stderr(&format!("\
-[ERROR] no example target named `example.rs`")));
+ execs().with_status(101).with_stderr("\
+[ERROR] no example target named `example.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`
-Did you mean `a`?")));
+Did you mean `a`?"));
});
test!(compile_path_dep_then_change_version {
"#).unwrap();
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`)
location searched: [..]
version required: = 0.0.1
versions found: 0.0.2
consider running `cargo update` to update a path dependency's locked version
-")));
+"));
});
test!(ignores_carriage_return_in_lockfile {
println!("bin");
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");
assert_that(p.cargo("test").arg("-v"),
.file("src/test.rs", "fn main() {}");
assert_that(p.cargo_process("build"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] cyclic package dependency: package `test v0.0.0 ([..])` depends on itself
-")));
+"));
});
test!(ignore_broken_symlinks {
"#);
assert_that(p.cargo_process("build"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]Cargo.toml`
Caused by:
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 {
this is not valid toml
"#);
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
Caused by:
could not parse input as TOML
[..].cargo[..]config:2:20-2:21 expected `=`, but found `i`
-")));
+"));
});
test!(cargo_platform_specific_dependency {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
- .with_stderr(format!("\
+ .with_stderr("\
[..] can't find crate for `bbbbb`[..]
[..] extern crate bbbbb; [..]
[..]
Caused by:
[..]
-")));
+"));
});
test!(cyclic_deps_rejected {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] cyclic package dependency: package `foo v0.0.1 ([..])` depends on itself
-")));
+"));
});
test!(predictable_filenames {
assert_that(p.cargo("build")
.env("RUSTC", "rustc-that-does-not-exist").arg("-v"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] Could not execute process `rustc-that-does-not-exist -vV` ([..])
Caused by:
[..]
-")));
+"));
assert_that(&p.bin("a"), is_not(existing_file()));
});
assert_that(p.cargo_process("build"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] package `foo v0.5.0 (file://[..])` specifies that it links to `a` but does \
not have a custom build script
-")));
+"));
});
test!(links_duplicates {
assert_that(p.cargo_process("build"),
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 \
linked to by one package
[..] v0.5.0 (file://[..])
[..] v0.5.0 (file://[..])
-")));
+"));
});
test!(overrides_and_links {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[..]
[..]
[..]
[..]
[..]
[RUNNING] `rustc [..] --crate-name foo [..] -L foo -L bar[..]`
-")));
+"));
});
test!(unused_overrides {
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..]`
-")));
+"));
});
test!(rebuild_continues_to_pass_env_vars {
println!("test");
assert_that(p.cargo("test").arg("-vj1"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..]`
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
println!("doc");
assert_that(p.cargo("doc").arg("-v"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[DOCUMENTING] foo v0.5.0 (file://[..])
[RUNNING] `rustdoc [..]`
-")));
+"));
File::create(&p.root().join("src/main.rs")).unwrap()
.write_all(b"fn main() {}").unwrap();
println!("run");
assert_that(p.cargo("run"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `target[..]foo[..]`
-")));
+"));
});
test!(propagation_of_l_flags {
assert_that(p.cargo_process("build").arg("-v").arg("-j1"),
execs().with_status(0)
- .with_stdout_contains(&format!("\
+ .with_stdout_contains("\
[RUNNING] `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name foo [..] -L bar -L foo`
-")));
+"));
});
test!(propagation_of_l_flags_new {
assert_that(p.cargo_process("build").arg("-v").arg("-j1"),
execs().with_status(0)
- .with_stdout_contains(&format!("\
+ .with_stdout_contains("\
[RUNNING] `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name foo [..] -L bar -L foo`
-")));
+"));
});
test!(build_deps_simple {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] a v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name a [..]`
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc build.rs [..] --extern a=[..]`
[RUNNING] `[..]foo-[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..]`
-")));
+"));
});
test!(build_deps_not_for_normal {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[..]lib.rs[..] error: can't find crate for `aaaaa`[..]
[..]lib.rs[..] extern crate aaaaa;
[..] ^~~~~~~~~~~~~~~~~~~
Caused by:
Process didn't exit successfully: [..]
-")));
+"));
});
test!(build_cmd_with_a_build_cmd {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] b v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name b [..]`
[COMPILING] a v0.5.0 (file://[..])
[RUNNING] `rustc [..]lib.rs --crate-name foo --crate-type lib -g \
--out-dir [..]target[..]debug --emit=dep-info,link \
-L [..]target[..]debug -L [..]target[..]deps`
-")));
+"));
});
test!(out_dir_is_preserved {
"#);
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc build.rs [..]`
[RUNNING] `[..]foo-[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo`
-")));
+"));
});
test!(output_separate_lines_new {
"#);
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `rustc build.rs [..]`
[RUNNING] `[..]foo-[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo`
-")));
+"));
});
#[cfg(not(windows))] // FIXME(#867)
"#);
assert_that(p.cargo_process("run"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `target[..]foo`
Hello, World!
-")));
+"));
assert_that(p.cargo_process("test"),
execs().with_status(0));
.file("build.rs", r#"fn main() {}"#);
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
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 {
"#);
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 ([..]
[RUNNING] `rustc a[..]build.rs [..]`
[RUNNING] `[..]build-script-build[..]`
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
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 ([..]
[COMPILING] b v0.5.0 ([..]
[RUNNING] `rustc b[..]src[..]lib.rs [..] -L test[..]`
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
test!(diamond_passes_args_only_once {
.file("c/src/lib.rs", "");
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 ([..]
[RUNNING] `rustc [..]`
[RUNNING] `[..]`
[RUNNING] `rustc [..]`
[COMPILING] foo v0.5.0 ([..]
[RUNNING] `[..]rlib -L native=test`
-")));
+"));
});
test!(adding_an_override_invalidates {
"#);
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 ([..]
[RUNNING] `rustc [..]`
[RUNNING] `[..]`
[RUNNING] `rustc [..] -L native=foo`
-")));
+"));
File::create(p.root().join(".cargo/config")).unwrap().write_all(format!("
[target.{}.foo]
", target).as_bytes()).unwrap();
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 ([..]
[RUNNING] `rustc [..] -L native=bar`
-")));
+"));
});
test!(changing_an_override_invalidates {
.file("build.rs", "");
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 ([..]
[RUNNING] `rustc [..] -L native=foo`
-")));
+"));
File::create(p.root().join(".cargo/config")).unwrap().write_all(format!("
[target.{}.foo]
", target).as_bytes()).unwrap();
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 ([..]
[RUNNING] `rustc [..] -L native=bar`
-")));
+"));
});
test!(rebuild_only_on_explicit_paths {
// files don't exist, so should always rerun if they don't exist
println!("run without");
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 ([..])
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]`
-")));
+"));
::sleep_ms(1000);
File::create(p.root().join("foo")).unwrap();
// now the exist, so run once, catch the mtime, then shouldn't run again
println!("run with");
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 ([..])
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]`
-")));
+"));
println!("run with2");
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 ([..])
-")));
+"));
::sleep_ms(1000);
println!("run baz");
File::create(p.root().join("baz")).unwrap();
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 ([..])
-")));
+"));
// but changing dependent files does
println!("run foo change");
File::create(p.root().join("foo")).unwrap();
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 ([..])
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]`
-")));
+"));
// .. as does deleting a file
println!("run foo delete");
fs::remove_file(p.root().join("bar")).unwrap();
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 ([..])
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]`
-")));
+"));
});
assert_that(p.cargo_process("test").arg("-v"),
execs().with_status(0)
- .with_stdout_contains(&format!("\
+ .with_stdout_contains("\
[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`
-")));
+"));
});
test!(please_respect_the_dag {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0)
- .with_stdout_contains(&format!("\
+ .with_stdout_contains("\
[RUNNING] `rustc [..] -L native=foo -L native=bar[..]`
-")));
+"));
});
test!(non_utf8_output {
assert_that(p.cargo("update")
.arg("-p").arg("bar")
.arg("--precise").arg("0.1.2"),
- execs().with_status(101).with_stderr(&format!("\
+ execs().with_status(101).with_stderr("\
[ERROR] Unable to update [..]
To learn more, run the command again with --verbose.
-")));
+"));
// Specifying a precise rev to the old rev shouldn't actually update
// anything because we already have the rev in the db.
println!("first run");
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] foo v0.5.0 ([..])\n\
[RUNNING] `target[..]foo[..]`\n\
- project2"))
+ project2")
.with_stderr("")
.with_status(0));
println!("last run");
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\
[RUNNING] `target[..]foo[..]`\n\
project3\
- "))
+ ")
.with_stderr("")
.with_status(0));
});
// Make sure we use the previous resolution of `bar` instead of updating it
// a second time.
assert_that(p.cargo("test"),
- execs().with_stdout(&format!("\
+ execs().with_stdout("\
[COMPILING] [..] v0.5.0 ([..])
[COMPILING] [..] v0.5.0 ([..]
[RUNNING] target[..]foo-[..]
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
test!(git_build_cmd_freshness {
assert_that(p.cargo("update")
.arg("-p").arg("foo"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] There are multiple `foo` packages in your project, and the specification `foo` \
is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the \
following:
foo:0.[..].0
foo:0.[..].0
-")));
+"));
});
test!(update_one_dep_in_repo_with_many_deps {
p.build();
assert_that(p.cargo("build"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[UPDATING] git repository `file://[..]a1`
[COMPILING] a v0.5.0 ([..]a1#[..]
[COMPILING] b v0.5.0 ([..])
[COMPILING] project v0.5.0 ([..])
-")));
+"));
File::create(&p.root().join("b/Cargo.toml")).unwrap().write_all(format!(r#"
[project]
assert_that(p.cargo("build"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[UPDATING] git repository `file://[..]a2`
[COMPILING] a v0.5.1 ([..]a2#[..]
[COMPILING] b v0.5.0 ([..])
[COMPILING] project v0.5.0 ([..])
-")));
+"));
});
test!(dont_require_submodules_are_checked_out {
.file("src/lib.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] git repository `[..]`
[COMPILING] a v0.5.0 ([..])
[COMPILING] foo v0.0.1 ([..])
-")));
+"));
});
test!(denied_lints_are_allowed {
.file("src/lib.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] git repository `[..]`
[COMPILING] a v0.5.0 ([..])
[COMPILING] foo v0.0.1 ([..])
-")));
+"));
});
test!(add_a_git_dep {
p2.build();
assert_that(p.cargo_process("test"),
- execs().with_stdout(&format!("\
+ execs().with_stdout("\
[COMPILING] [..] v0.5.0 ([..])
[COMPILING] [..] v0.5.0 ([..])
[RUNNING] target[..]foo-[..]
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
test!(cargo_compile_with_transitive_dev_deps {
assert_that(p.cargo_process("build"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] Unable to update file://[..]
Caused by:
Caused by:
[..] (os error [..])
-")));
+"));
});
p.build();
assert_that(p.cargo("build"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] a v0.5.0 ([..])
[COMPILING] foo v0.5.0 ([..])
-")));
+"));
assert_that(p.cargo("build")
.arg("--manifest-path=b/Cargo.toml")
.env("CARGO_TARGET_DIR", "target"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] b v0.5.0 ([..])
-")));
+"));
});
test!(override_and_depend {
p.build();
assert_that(p.cargo("build").cwd(p.root().join("b")),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] a2 v0.5.0 ([..])
[COMPILING] a1 v0.5.0 ([..])
[COMPILING] b v0.5.0 ([..])
-")));
+"));
});
test!(missing_path_dependency {
p.build();
assert_that(p.cargo("build"),
execs().with_status(101)
- .with_stderr(format!("\
+ .with_stderr("\
[ERROR] failed to update path override `[..]../whoa-this-does-not-exist` \
(defined in `[..]`)
Caused by:
[..] (os error [..])
-")));
+"));
});
foo.build();
assert_that(bar.cargo_process("build").arg("--verbose"),
- execs().with_stdout(&format!("\
+ execs().with_stdout("\
[COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
-")));
+"));
});
let a = a.join().unwrap();
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 `[..]`
-")));
+"));
assert_that(good, execs().with_status(0).with_stderr_contains("\
warning: be sure to add `[..]` to your PATH [..]
"));
let b = b.wait_with_output().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 [..]
-")));
- assert_that(b, execs().with_status(0).with_stdout(&format!("\
+"));
+ assert_that(b, execs().with_status(0).with_stdout("\
[COMPILING] foo v0.0.0 [..]
-")));
+"));
});
.with_stdout_contains(&format!("\
[RUNNING] `{dir}[..]target[..]build[..]d1-[..]build-script-build`",
dir = p.root().display()))
- .with_stdout_contains(&format!("\
-[RUNNING] `rustc d1[..]src[..]lib.rs [..]`"))
+ .with_stdout_contains("\
+[RUNNING] `rustc d1[..]src[..]lib.rs [..]`")
.with_stdout_contains(&format!("\
[COMPILING] d2 v0.0.0 ({url}/d2)", url = p.url()))
.with_stdout_contains(&format!("\
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(alternate()),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc build.rs [..]`
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc src[..]lib.rs [..]`
-")));
+"));
});
test!(build_script_with_platform_specific_dependencies {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
execs().with_status(101)
- .with_stderr(format!("\
+ .with_stderr("\
[..] error: can't find crate for `d2`[..]
[..] extern crate d2;
[..]
Caused by:
[..]
-")));
+"));
});
test!(platform_specific_variables_reflected_in_build_scripts {
assert_that(p.cargo_process("doc"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[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`
-")));
+"));
});
test!(doc_dash_p {
assert_that(p.cargo_process("doc").arg("-p").arg("a"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[..] b v0.0.1 (file://[..])
[..] b v0.0.1 (file://[..])
[DOCUMENTING] a v0.0.1 (file://[..])
-")));
+"));
});
test!(doc_same_name {
execs().with_status(0));
assert_that(p.cargo("doc").arg("--release").arg("-v"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[DOCUMENTING] foo v0.0.1 ([..])
[RUNNING] `rustdoc src[..]lib.rs [..]`
-")));
+"));
});
test!(doc_multiple_deps {
.file("src/main.rs", "");
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 `[..]`
Caused by:
Feature `bar` includes `baz` which is neither a dependency nor another feature
-")));
+"));
});
test!(invalid2 {
.file("src/main.rs", "");
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 `[..]`
Caused by:
Features and dependencies cannot have the same name: `bar`
-")));
+"));
});
test!(invalid3 {
.file("src/main.rs", "");
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 `[..]`
Caused by:
Feature `bar` depends on `baz` which is not an optional dependency.
Consider adding `optional = true` to the dependency
-")));
+"));
});
test!(invalid4 {
.file("bar/src/lib.rs", "");
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`
-")));
+"));
let p = p.file("Cargo.toml", r#"
[project]
"#);
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`
-")));
+"));
});
test!(invalid5 {
.file("src/main.rs", "");
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 `[..]`
Caused by:
Dev-dependencies are not allowed to be optional: `bar`
-")));
+"));
});
test!(invalid6 {
.file("src/main.rs", "");
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 `[..]`
Caused by:
Feature `foo` requires `bar` which is not an optional dependency
-")));
+"));
});
test!(invalid7 {
.file("src/main.rs", "");
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 `[..]`
Caused by:
Feature `foo` requires `bar` which is not an optional dependency
-")));
+"));
});
test!(invalid8 {
.file("bar/src/lib.rs", "");
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`
-")));
+"));
});
test!(no_feature_doesnt_build {
.file("src/main.rs", "");
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
-")));
+"));
});
test!(cyclic_feature2 {
.file("src/main.rs", "");
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
-")));
+"));
});
test!(groups_on_groups_on_groups {
p.root().move_into_the_past().unwrap();
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] b v0.1.0 ([..])
-")));
+"));
});
// Tests that all cmd lines work with `--features ""`
.file("foo/src/lib.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stdout("\
[COMPILING] test v0.1.0 ([..])
-")));
+"));
});
test!(activating_feature_activates_dep {
execs().with_status(0));
assert_that(p.cargo("test").arg("--no-run"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] c v0.0.1 ([..])
[COMPILING] b v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..])
-")));
+"));
});
test!(rerun_if_changed_in_dep {
assert_that(cargo_process("init").arg("--vcs").arg("none")
.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`
-")));
+"));
assert_that(&paths::root().join("foo/Cargo.toml"), is_not(existing_file()));
});
assert_that(cargo_process("init").arg("--vcs").arg("none")
.env("USER", "foo").cwd(&path),
- execs().with_status(101).with_stderr(&format!("\
+ execs().with_status(101).with_stderr("\
[ERROR] multiple possible binary sources found:
main.rs
foo.rs
cannot automatically generate Cargo.toml as the main target would be ambiguous
-")));
+"));
assert_that(&paths::root().join("foo/Cargo.toml"), is_not(existing_file()));
});
fs::create_dir_all(&foo).unwrap();
assert_that(cargo_process("init").cwd(foo.clone())
.env("USER", "foo"),
- execs().with_status(101).with_stderr(&format!("\
+ execs().with_status(101).with_stderr("\
[ERROR] Invalid character `.` in crate name: `foo.bar`
use --name to override crate name
-")));
+"));
assert_that(&foo.join("Cargo.toml"), is_not(existing_file()));
});
fs::create_dir_all(&test).unwrap();
assert_that(cargo_process("init").cwd(test.clone())
.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\
use --name to override crate name
-")));
+"));
assert_that(&test.join("Cargo.toml"), is_not(existing_file()));
});
test!(unknown_flags {
assert_that(cargo_process("init").arg("foo").arg("--flag"),
execs().with_status(1)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] Unknown flag: '--flag'
Usage:
cargo init [options] [<path>]
cargo init -h | --help
-")));
+"));
});
#[cfg(not(windows))]
test!(missing {
pkg("foo", "0.0.1");
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://[..]`
-")));
+"));
});
test!(bad_version {
pkg("foo", "0.0.1");
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`
-")));
+"));
});
test!(no_crate {
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 [..]
Caused by:
Caused by:
[..] (os error [..])
-")));
+"));
});
test!(install_location_precedence {
execs().with_status(0));
assert_that(cargo_home(), has_installed_exe("foo"));
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 [..]`
Add --force to overwrite
-")));
+"));
});
test!(multiple_crates_error {
p.build();
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
-")));
+"));
});
test!(multiple_crates_select {
p.build();
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
-")));
+"));
});
test!(no_binaries {
p.build();
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
-")));
+"));
});
test!(examples {
assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(0));
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 ([..])`
binary `foo-bin2[..]` already exists in destination as part of `foo v0.1.0 ([..])`
Add --force to overwrite
-")));
+"));
});
test!(install_force {
p.build();
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: aborting due to previous error
[ERROR] failed to compile `foo v0.1.0 (file://[..])`, intermediate artifacts can be \
Could not compile `foo`.
To learn more, run the command again with --verbose.
-")));
+"));
});
test!(git_repo {
test!(uninstall_pkg_does_not_exist {
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
-")));
+"));
});
test!(uninstall_bin_does_not_exist {
assert_that(cargo_process("install").arg("foo"),
execs().with_status(0));
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 ([..])`
-")));
+"));
});
test!(uninstall_piecemeal {
assert_that(cargo_home(), is_not(has_installed_exe("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
-")));
+"));
});
test!(subcommand_works_out_of_the_box {
.file("Cargo.toml", "");
assert_that(p.cargo_process("metadata"), execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
- no `package` or `project` section found.")))
+ no `package` or `project` section found."))
});
const MANIFEST_OUTPUT: &'static str=
.arg("--manifest-path").arg("foo")
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("[ERROR] the manifest-path must be \
- a path to a Cargo.toml file")));
+ .with_stderr("[ERROR] the manifest-path must be \
+ a path to a Cargo.toml file"));
});
test!(cargo_metadata_no_deps_path_to_cargo_toml_parent_absolute {
.arg("--manifest-path").arg(p.root())
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("[ERROR] the manifest-path must be \
- a path to a Cargo.toml file")));
+ .with_stderr("[ERROR] the manifest-path must be \
+ a path to a Cargo.toml file"));
});
test!(cargo_metadata_no_deps_cwd {
test!(no_argument {
assert_that(cargo_process("new"),
execs().with_status(1)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] Invalid arguments.
Usage:
cargo new [options] <path>
cargo new -h | --help
-")));
+"));
});
test!(existing {
test!(invalid_characters {
assert_that(cargo_process("new").arg("foo.rs"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] Invalid character `.` in crate name: `foo.rs`
-use --name to override crate name")));
+use --name to override crate name"));
});
test!(reserved_name {
assert_that(cargo_process("new").arg("test"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[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!(unknown_flags {
assert_that(cargo_process("new").arg("foo").arg("--flag"),
execs().with_status(1)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] Unknown flag: '--flag'
Usage:
cargo new [..]
cargo new [..]
-")));
+"));
});
");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]`
[UPDATING] git repository `[..]`
[COMPILING] foo v0.1.0 (file://[..])
[COMPILING] local v0.0.1 (file://[..])
-")));
+"));
});
test!(missing_version {
.file("src/lib.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]`
[UPDATING] git repository `[..]`
[DOWNLOADING] bar v0.2.0 (registry [..])
[COMPILING] foo v0.1.0 (file://[..])
[COMPILING] bar v0.2.0 (registry [..])
[COMPILING] local v0.0.1 (file://[..])
-")));
+"));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
});
");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]`
[UPDATING] git repository `file://[..]`
[COMPILING] foo v0.1.0 (file://[..])
[COMPILING] local v0.0.1 (file://[..])
-")));
+"));
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(""));
");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]`
[COMPILING] foo v0.1.0 (file://[..])
[COMPILING] local v0.0.1 (file://[..])
-")));
+"));
});
test!(use_a_spec_to_select {
");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]`
[UPDATING] git repository `[..]`
[DOWNLOADING] [..]
[COMPILING] [..]
[COMPILING] [..]
[COMPILING] local v0.0.1 (file://[..])
-")));
+"));
});
test!(override_adds_some_deps {
.file("src/lib.rs", "");
assert_that(p.cargo_process("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `file://[..]`
[UPDATING] git repository `[..]`
[DOWNLOADING] foo v0.1.1 (registry [..])
[COMPILING] foo v0.1.1 (registry [..])
[COMPILING] bar v0.1.0 ([..])
[COMPILING] local v0.0.1 (file://[..])
-")));
+"));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
Package::new("foo", "0.1.2").publish();
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://[..]`
-")));
+"));
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://[..]`
-")));
+"));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
});
cargo.cwd(p.root());
assert_that(cargo.clone().arg("build"), execs().with_status(0));
assert_that(cargo.arg("package").arg("--list"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
Cargo.toml
src/main.rs
-")));
+"));
});
test!(ignore_nested {
.file("src/:foo", "");
assert_that(p.cargo_process("package"),
- execs().with_status(101).with_stderr(format!("\
+ execs().with_status(101).with_stderr("\
warning: [..]
[ERROR] failed to prepare local package for uploading
Caused by:
cannot package a filename with a special character `:`: src/:foo
-")));
+"));
});
.file("src/main.rs", "fn main() {}");
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.
dependency `foo` comes from git://path/to/nowhere instead
-")));
+"));
});
test!(path_dependency_no_version {
.file("bar/src/lib.rs", "");
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.
dependency `bar` does not specify a version
-")));
+"));
});
test!(unpublishable_crate {
.file("src/main.rs", "fn main() {}");
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.
`foo` is marked as unpublishable
-")));
+"));
});
.arg("--manifest-path").arg("foo")
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("[ERROR] the manifest-path must be \
- a path to a Cargo.toml file")));
+ .with_stderr("[ERROR] the manifest-path must be \
+ a path to a Cargo.toml file"));
});
test!(cargo_read_manifest_path_to_cargo_toml_parent_absolute {
.arg("--manifest-path").arg(p.root())
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("[ERROR] the manifest-path must be \
- a path to a Cargo.toml file")));
+ .with_stderr("[ERROR] the manifest-path must be \
+ a path to a Cargo.toml file"));
});
test!(cargo_read_manifest_cwd {
.file("src/main.rs", "fn main() {}");
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`)
location searched: registry file://[..]
version required: >= 0.0.0
-")));
+"));
});
test!(wrong_version {
Package::new("foo", "0.0.2").publish();
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`)
location searched: registry file://[..]
version required: >= 1.0.0
versions found: 0.0.2, 0.0.1
-")));
+"));
Package::new("foo", "0.0.3").publish();
Package::new("foo", "0.0.4").publish();
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`)
location searched: registry file://[..]
version required: >= 1.0.0
versions found: 0.0.4, 0.0.3, 0.0.2, ...
-")));
+"));
});
test!(bad_cksum {
File::create(&pkg.archive_dst()).unwrap();
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
Caused by:
Caused by:
failed to verify the checksum of `bad-cksum v0.0.1 (registry file://[..])`
-")));
+"));
});
test!(update_registry {
.file("src/main.rs", "fn main() {}");
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`)
location searched: registry file://[..]
version required: >= 0.0.0
-")));
+"));
Package::new("notyet", "0.0.1").publish();
p.build();
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
Caused by:
no matching package named `notyet` found (required by `foo`)
location searched: registry file://[..]
version required: ^0.0.1
-")));
+"));
Package::new("notyet", "0.0.1").publish();
Package::new("bar", "0.0.1").dep("baz", "=0.0.2").publish();
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`)
location searched: registry file://[..]
version required: = 0.0.2
versions found: 0.0.1
-")));
+"));
});
test!(yanks_in_lockfiles_are_ok {
execs().with_status(0).with_stdout(""));
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`)
location searched: registry file://[..]
version required: *
-")));
+"));
});
test!(update_with_lockfile_if_packages_missing {
paths::home().join(".cargo/registry").rm_rf().unwrap();
assert_that(p.cargo("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]`
[DOWNLOADING] bar v0.0.1 (registry file://[..])
-")));
+"));
});
test!(update_lockfile {
println!("0.0.2 update");
assert_that(p.cargo("update")
.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] bar v0.0.1 (registry file://[..]) -> v0.0.2
-")));
+"));
println!("0.0.2 build");
assert_that(p.cargo("build"),
println!("0.0.3 update");
assert_that(p.cargo("update")
.arg("-p").arg("bar"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]`
[UPDATING] bar v0.0.2 (registry file://[..]) -> v0.0.3
-")));
+"));
println!("0.0.3 build");
assert_that(p.cargo("build"),
"#);
assert_that(p.cargo_process("publish").arg("-v"),
execs().with_status(101)
- .with_stderr(&format!("\
-[ERROR] the license file `foo` does not exist")));
+ .with_stderr("\
+[ERROR] the license file `foo` does not exist"));
});
test!(updating_a_dep {
assert_that(p.cargo("fetch"),
execs().with_status(0)
- .with_stdout(format!("\
+ .with_stdout("\
[UPDATING] registry `[..]`
[DOWNLOADING] a v0.1.0 (registry [..])
-")));
+"));
});
test!(update_transitive_dependency {
assert_that(p.cargo("update").arg("-pb"),
execs().with_status(0)
- .with_stdout(format!("\
+ .with_stdout("\
[UPDATING] registry `[..]`
[UPDATING] b v0.1.0 (registry [..]) -> v0.1.1
-")));
+"));
assert_that(p.cargo("build"),
execs().with_status(0)
- .with_stdout(format!("\
+ .with_stdout("\
[DOWNLOADING] b v0.1.1 (registry file://[..])
[COMPILING] b v0.1.1 (registry [..])
[COMPILING] a v0.1.0 (registry [..])
[COMPILING] foo v0.5.0 ([..])
-")));
+"));
});
test!(update_backtracking_ok {
assert_that(p.cargo("update").arg("-p").arg("hyper"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[UPDATING] registry `[..]`
-")));
+"));
});
test!(update_multiple_packages {
assert_that(p.cargo("update").arg("-pa").arg("-pb"),
execs().with_status(0)
- .with_stdout(format!("\
+ .with_stdout("\
[UPDATING] registry `[..]`
[UPDATING] a 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"),
execs().with_status(0)
- .with_stdout(format!("\
+ .with_stdout("\
[UPDATING] registry `[..]`
[UPDATING] c v0.1.0 (registry [..]) -> v0.1.1
-")));
+"));
assert_that(p.cargo("build"),
execs().with_status(0)
- .with_stdout_contains(format!("\
-[DOWNLOADING] a v0.1.1 (registry file://[..])"))
- .with_stdout_contains(format!("\
-[DOWNLOADING] b v0.1.1 (registry file://[..])"))
- .with_stdout_contains(format!("\
-[DOWNLOADING] c v0.1.1 (registry file://[..])"))
- .with_stdout_contains(format!("\
-[COMPILING] a v0.1.1 (registry [..])"))
- .with_stdout_contains(format!("\
-[COMPILING] b v0.1.1 (registry [..])"))
- .with_stdout_contains(format!("\
-[COMPILING] c v0.1.1 (registry [..])"))
- .with_stdout_contains(format!("\
-[COMPILING] foo v0.5.0 ([..])")));
+ .with_stdout_contains("\
+[DOWNLOADING] a v0.1.1 (registry file://[..])")
+ .with_stdout_contains("\
+[DOWNLOADING] b v0.1.1 (registry file://[..])")
+ .with_stdout_contains("\
+[DOWNLOADING] c v0.1.1 (registry file://[..])")
+ .with_stdout_contains("\
+[COMPILING] a v0.1.1 (registry [..])")
+ .with_stdout_contains("\
+[COMPILING] b v0.1.1 (registry [..])")
+ .with_stdout_contains("\
+[COMPILING] c v0.1.1 (registry [..])")
+ .with_stdout_contains("\
+[COMPILING] foo v0.5.0 ([..])"));
});
test!(bundled_crate_in_registry {
Package::new("baz", "0.1.0").publish();
assert_that(p.cargo("build"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0).with_stdout("\
[UPDATING] registry `[..]`
[DOWNLOADING] baz v0.1.0 ([..])
[COMPILING] baz v0.1.0 ([..])
[COMPILING] bar v0.5.0 ([..])
-")));
+"));
});
test!(resolve_and_backtracking {
"#);
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
-")));
+"));
});
test!(quiet_and_verbose_config {
assert_that(p.cargo_process("run"),
execs().with_status(2)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] Process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
-")));
+"));
});
test!(exit_code_verbose {
assert_that(p.cargo_process("run").arg("-v"),
execs().with_status(2)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] Process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
-")));
+"));
});
test!(no_main_file {
assert_that(p.cargo_process("run"),
execs().with_status(101)
- .with_stderr(&format!("[ERROR] a bin target must be available \
- for `cargo run`\n")));
+ .with_stderr("[ERROR] a bin target must be available \
+ for `cargo run`\n"));
});
test!(too_many_bins {
assert_that(p.cargo_process("run"),
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 \
- to specify which one to run\n")));
+ to specify which one to run\n"));
});
test!(specify_name {
"#);
assert_that(p.cargo_process("run").arg("--bin").arg("bin.rs"),
- execs().with_status(101).with_stderr(&format!("\
-[ERROR] no bin target named `bin.rs`")));
+ execs().with_status(101).with_stderr("\
+[ERROR] no bin target named `bin.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`
-Did you mean `a`?")));
+Did you mean `a`?"));
assert_that(p.cargo_process("run").arg("--example").arg("example.rs"),
- execs().with_status(101).with_stderr(&format!("\
-[ERROR] no example target named `example.rs`")));
+ execs().with_status(101).with_stderr("\
+[ERROR] no example target named `example.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`
-Did you mean `a`?")));
+Did you mean `a`?"));
});
test!(either_name_or_example {
assert_that(p.cargo_process("run").arg("--bin").arg("a").arg("--example").arg("b"),
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 \
- specified")));
+ specified"));
});
test!(one_bin_multiple_examples {
fn setup() {
}
-fn cargo_rustc_error() -> String {
- format!("[ERROR] extra arguments to `rustc` can only be passed to one target, \
- consider filtering\nthe package by passing e.g. `--lib` or `--bin NAME` to \
- specify a single target")
-}
+const CARGO_RUSTC_ERROR: &'static str =
+"[ERROR] extra arguments to `rustc` can only be passed to one target, consider filtering
+the package by passing e.g. `--lib` or `--bin NAME` to specify a single target";
test!(build_lib_for_foo {
let p = project("foo")
.arg("--").arg("-Z").arg("unstable-options"),
execs()
.with_status(101)
- .with_stderr(&cargo_rustc_error()));
+ .with_stderr(CARGO_RUSTC_ERROR));
});
test!(build_with_args_to_one_of_multiple_binaries {
.arg("--").arg("-Z").arg("unstable-options"),
execs()
.with_status(101)
- .with_stderr(&cargo_rustc_error()));
+ .with_stderr(CARGO_RUSTC_ERROR));
});
test!(build_with_args_to_one_of_multiple_tests {
.arg("--").arg("-Z").arg("unstable-options"),
execs()
.with_status(0)
- .with_stdout(format!("\
+ .with_stdout("\
[COMPILING] bar v0.1.0 ([..])
[RUNNING] `[..]--crate-name bar --crate-type lib [..] -Z unstable-options [..]`
-")));
+"));
});
test!(fail_with_multiple_packages {
assert_that(foo.cargo("rustc").arg("-v").arg("-p").arg("bar")
.arg("-p").arg("baz"),
- execs().with_status(1).with_stderr(format!("\
+ execs().with_status(1).with_stderr("\
[ERROR] Invalid arguments.
Usage:
- cargo rustc [options] [--] [<opts>...]")));
+ cargo rustc [options] [--] [<opts>...]"));
});
test!(rustc_with_other_profile {
.arg("--").arg("--no-defaults"),
execs()
.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 \
- or marking the target as `doc = false`")));
+ or marking the target as `doc = false`"));
});
}
assert_that(cargo_process("search").arg("postgres"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stdout("\
[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 {
}
assert_that(cargo_process("search").arg("postgres").arg("sql"),
- execs().with_status(0).with_stdout(format!("\
+ execs().with_status(0).with_stdout("\
[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 {
assert_that(p.cargo("test").arg("foo"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[RUNNING] target[..]foo-[..]
running 1 test
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
// Regression test for running cargo-test twice with
assert_that(p.cargo_process("test"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
- binary target bin.name is required")));
+ binary target bin.name is required"));
});
test!(bench_without_name {
assert_that(p.cargo_process("test"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
- bench target bench.name is required")));
+ bench target bench.name is required"));
});
test!(test_without_name {
assert_that(p.cargo_process("test"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
- test target test.name is required")));
+ test target test.name is required"));
});
test!(example_without_name {
assert_that(p.cargo_process("test"),
execs().with_status(101)
- .with_stderr(&format!("\
+ .with_stderr("\
[ERROR] failed to parse manifest at `[..]`
Caused by:
- example target example.name is required")));
+ example target example.name is required"));
});
test!(bin_there_for_integration {
p.root().move_into_the_past().unwrap();
assert_that(p.cargo("test"),
execs().with_status(0)
- .with_stdout(format!("\
+ .with_stdout("\
[RUNNING] target[..]foo-[..]
running 1 test
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
assert_that(p.cargo("test"),
execs().with_status(0)
- .with_stdout(format!("\
+ .with_stdout("\
[RUNNING] target[..]foo-[..]
running 1 test
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
test!(test_then_build {
assert_that(p.cargo("run"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.0.1 ([..])
[RUNNING] [..]
bin
-")));
+"));
assert_that(&p.bin("foo"), existing_file());
});
assert_that(p.cargo_process("test").arg("-v"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[..]
[..]
[..]
[..]
[RUNNING] `rustc [..] --crate-name ex [..] --extern a=[..]`
-")));
+"));
});
test!(bin_is_preserved {
.file("src/lib.rs", "");
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`
-")));
+"));
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`
-")));
+"));
});
test!(doctest_feature {
"#);
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 [..]
[RUNNING] target[..]foo[..]
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-")))
+"))
});
test!(dashes_to_underscores {
.file("tests/foo.rs", "");
assert_that(p.cargo_process("test").arg("--test=foo"),
- execs().with_stdout(format!("\
+ execs().with_stdout("\
[COMPILING] foo v0.0.1 ([..])
[RUNNING] target[..]debug[..]foo[..]
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
test!(dylib_doctest {
"#);
assert_that(p.cargo_process("test"),
- execs().with_stdout(format!("\
+ execs().with_stdout("\
[COMPILING] foo v0.0.1 ([..])
[DOCTEST] foo
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
test!(dylib_doctest2 {
extern crate foo;
"#);
assert_that(p.cargo_process("test"),
- execs().with_stdout(format!("\
+ execs().with_stdout("\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] bar v0.0.1 ([..])
[RUNNING] target[..]foo[..]
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-")))
+"))
});
test!(dev_dep_with_build_script {
"#);
assert_that(p.cargo_process("test").arg("--no-fail-fast"),
execs().with_status(101)
- .with_stdout_contains(format!("\
+ .with_stdout_contains("\
[COMPILING] foo v0.0.1 ([..])
[RUNNING] target[..]foo[..]
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
[RUNNING] target[..]test_add_one[..]
-"))
- .with_stdout_contains(format!("\
+")
+ .with_stdout_contains("\
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured
[RUNNING] target[..]test_sub_one[..]
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-")))
+"))
});
test!(test_multiple_packages {
assert_that(p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"),
execs().with_status(0)
- .with_stdout_contains(&format!("\
+ .with_stdout_contains("\
[RUNNING] target[..]debug[..]d1-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-"))
- .with_stdout_contains(&format!("\
+")
+ .with_stdout_contains("\
[RUNNING] target[..]debug[..]d2-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-")));
+"));
});
test!(bin_does_not_rebuild_tests {
assert_that(p.cargo("test").arg("-v").arg("--no-run"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stdout("\
[COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc src[..]main.rs [..]`
[RUNNING] `rustc src[..]main.rs [..]`
-")));
+"));
});
test!(selective_test_wonky_profile {
assert_that(p.cargo("test").arg("-v").arg("--no-run")
.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 ([..])
[RUNNING] `rustc a[..]src[..]lib.rs [..]`
[RUNNING] `rustc a[..]src[..]lib.rs [..]`
-")));
+"));
});
test!(only_test_docs {