clippy: resolve all warnings about useless format!()

This commit is contained in:
Matthias Krüger 2018-09-03 11:38:29 +02:00
parent 78bae459fe
commit 2cd9cce6e3
23 changed files with 338 additions and 339 deletions

View file

@ -37,12 +37,12 @@ fn cargo_bench_simple() {
p.process(&p.bin("foo")).with_stdout("hello\n").run();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]",
)).with_stdout_contains("test bench_hello ... bench: [..]")
).with_stdout_contains("test bench_hello ... bench: [..]")
.run();
}
@ -76,14 +76,14 @@ fn bench_bench_implicit() {
).build();
p.cargo("bench --benches")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]
[RUNNING] target/release/deps/mybench-[..][EXE]
",
)).with_stdout_contains("test run2 ... bench: [..]")
).with_stdout_contains("test run2 ... bench: [..]")
.run();
}
@ -117,13 +117,13 @@ fn bench_bin_implicit() {
).build();
p.cargo("bench --bins")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]
",
)).with_stdout_contains("test run1 ... bench: [..]")
).with_stdout_contains("test run1 ... bench: [..]")
.run();
}
@ -149,13 +149,13 @@ fn bench_tarname() {
).build();
p.cargo("bench --bench bin2")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/bin2-[..][EXE]
",
)).with_stdout_contains("test run2 ... bench: [..]")
).with_stdout_contains("test run2 ... bench: [..]")
.run();
}
@ -213,13 +213,13 @@ fn cargo_bench_verbose() {
).build();
p.cargo("bench -v hello")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[RUNNING] `rustc [..] src/main.rs [..]`
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] `[..]target/release/deps/foo-[..][EXE] hello --bench`",
)).with_stdout_contains("test bench_hello ... bench: [..]")
).with_stdout_contains("test bench_hello ... bench: [..]")
.run();
}
@ -303,12 +303,12 @@ fn cargo_bench_failing_test() {
// Force libtest into serial execution so that the test header will be printed.
p.cargo("bench -- --test-threads=1")
.with_stdout_contains("test bench_hello ...[..]")
.with_stderr_contains(format!(
.with_stderr_contains(
"\
[COMPILING] foo v0.5.0 (CWD)[..]
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]",
)).with_either_contains(
).with_either_contains(
"[..]thread '[..]' panicked at 'assertion failed: `(left == right)`[..]",
).with_either_contains("[..]left: `\"hello\"`[..]")
.with_either_contains("[..]right: `\"nope\"`[..]")
@ -370,13 +370,13 @@ fn bench_with_lib_dep() {
).build();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]
[RUNNING] target/release/deps/baz-[..][EXE]",
)).with_stdout_contains("test lib_bench ... bench: [..]")
).with_stdout_contains("test lib_bench ... bench: [..]")
.with_stdout_contains("test bin_bench ... bench: [..]")
.run();
}
@ -430,13 +430,13 @@ fn bench_with_deep_lib_dep() {
).build();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] bar v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/bar-[..][EXE]",
)).with_stdout_contains("test bar_bench ... bench: [..]")
).with_stdout_contains("test bar_bench ... bench: [..]")
.run();
}
@ -484,13 +484,13 @@ fn external_bench_explicit() {
).build();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]
[RUNNING] target/release/deps/bench-[..][EXE]",
)).with_stdout_contains("test internal_bench ... bench: [..]")
).with_stdout_contains("test internal_bench ... bench: [..]")
.with_stdout_contains("test external_bench ... bench: [..]")
.run();
}
@ -528,13 +528,13 @@ fn external_bench_implicit() {
).build();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]
[RUNNING] target/release/deps/external-[..][EXE]",
)).with_stdout_contains("test internal_bench ... bench: [..]")
).with_stdout_contains("test internal_bench ... bench: [..]")
.with_stdout_contains("test external_bench ... bench: [..]")
.run();
}
@ -588,7 +588,7 @@ fn bench_autodiscover_2015() {
p.cargo("bench bench_basic")
.masquerade_as_nightly_cargo()
.with_stderr(&format!(
.with_stderr(
"warning: \
An explicit [[bench]] section is specified in Cargo.toml which currently
disables Cargo from automatically inferring other benchmark targets.
@ -609,7 +609,7 @@ https://github.com/rust-lang/cargo/issues/5330
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]
",
)).run();
).run();
}
#[test]
@ -647,12 +647,12 @@ fn pass_through_command_line() {
).build();
p.cargo("bench bar")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]",
)).with_stdout_contains("test bar ... bench: [..]")
).with_stdout_contains("test bar ... bench: [..]")
.run();
p.cargo("bench foo")
@ -734,13 +734,13 @@ fn lib_bin_same_name() {
).build();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]
[RUNNING] target/release/deps/foo-[..][EXE]",
)).with_stdout_contains_n("test [..] ... bench: [..]", 2)
).with_stdout_contains_n("test [..] ... bench: [..]", 2)
.run();
}
@ -780,13 +780,13 @@ fn lib_with_standard_name() {
).build();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] syntax v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/syntax-[..][EXE]
[RUNNING] target/release/deps/bench-[..][EXE]",
)).with_stdout_contains("test foo_bench ... bench: [..]")
).with_stdout_contains("test foo_bench ... bench: [..]")
.with_stdout_contains("test bench ... bench: [..]")
.run();
}
@ -829,12 +829,12 @@ fn lib_with_standard_name2() {
).build();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] syntax v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/syntax-[..][EXE]",
)).with_stdout_contains("test bench ... bench: [..]")
).with_stdout_contains("test bench ... bench: [..]")
.run();
}
@ -899,7 +899,7 @@ fn bench_dylib() {
.build();
p.cargo("bench -v")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] bar v0.0.1 (CWD/bar)
[RUNNING] [..] -C opt-level=3 [..]
@ -910,19 +910,19 @@ fn bench_dylib() {
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] `[..]target/release/deps/foo-[..][EXE] --bench`
[RUNNING] `[..]target/release/deps/bench-[..][EXE] --bench`",
)).with_stdout_contains_n("test foo ... bench: [..]", 2)
).with_stdout_contains_n("test foo ... bench: [..]", 2)
.run();
p.root().move_into_the_past();
p.cargo("bench -v")
.with_stderr(&format!(
.with_stderr(
"\
[FRESH] bar v0.0.1 (CWD/bar)
[FRESH] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] `[..]target/release/deps/foo-[..][EXE] --bench`
[RUNNING] `[..]target/release/deps/bench-[..][EXE] --bench`",
)).with_stdout_contains_n("test foo ... bench: [..]", 2)
).with_stdout_contains_n("test foo ... bench: [..]", 2)
.run();
}
@ -955,12 +955,12 @@ fn bench_twice_with_build_cmd() {
).build();
p.cargo("bench")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]",
)).with_stdout_contains("test foo ... bench: [..]")
).with_stdout_contains("test foo ... bench: [..]")
.run();
p.cargo("bench")
@ -1039,7 +1039,7 @@ fn bench_with_examples() {
).build();
p.cargo("bench -v")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v6.6.6 (CWD)
[RUNNING] `rustc [..]`
@ -1048,7 +1048,7 @@ fn bench_with_examples() {
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] `CWD/target/release/deps/foo-[..][EXE] --bench`
[RUNNING] `CWD/target/release/deps/testb1-[..][EXE] --bench`",
)).with_stdout_contains("test bench_bench1 ... bench: [..]")
).with_stdout_contains("test bench_bench1 ... bench: [..]")
.with_stdout_contains("test bench_bench2 ... bench: [..]")
.run();
}

View file

@ -1017,13 +1017,13 @@ fn main(){
p2.cargo("run -Zoffline")
.masquerade_as_nightly_cargo()
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] present_dep v1.2.3
[COMPILING] foo v0.1.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
Running `[..]`",
)).with_stdout("1.2.3")
).with_stdout("1.2.3")
.run();
}
@ -1613,7 +1613,7 @@ fn lto_build() {
).file("src/main.rs", "fn main() {}")
.build();
p.cargo("build -v --release")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] test v0.0.0 (CWD)
[RUNNING] `rustc --crate-name test src/main.rs --crate-type bin \
@ -1625,14 +1625,14 @@ fn lto_build() {
-L dependency=CWD/target/release/deps`
[FINISHED] release [optimized] target(s) in [..]
",
)).run();
).run();
}
#[test]
fn verbose_build() {
let p = project().file("src/lib.rs", "").build();
p.cargo("build -v")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \
@ -1642,14 +1642,14 @@ fn verbose_build() {
-L dependency=CWD/target/debug/deps`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
fn verbose_release_build() {
let p = project().file("src/lib.rs", "").build();
p.cargo("build -v --release")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \
@ -1660,7 +1660,7 @@ fn verbose_release_build() {
-L dependency=CWD/target/release/deps`
[FINISHED] release [optimized] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -2030,12 +2030,12 @@ fn lib_with_standard_name() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] syntax v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -2140,12 +2140,12 @@ fn freshness_ignores_excluded() {
foo.root().move_into_the_past();
foo.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
// Smoke test to make sure it doesn't compile again
println!("first pass");
@ -2191,21 +2191,21 @@ fn rebuild_preserves_out_dir() {
foo.cargo("build")
.env("FIRST", "1")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
File::create(&foo.root().join("src/bar.rs")).unwrap();
foo.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]

View file

@ -29,14 +29,14 @@ fn custom_build_script_failed() {
.build();
p.cargo("build -v")
.with_status(101)
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[RUNNING] `rustc --crate-name build_script_build build.rs --crate-type bin [..]`
[RUNNING] `[..]/build-script-build`
[ERROR] failed to run custom build command for `foo v0.5.0 (CWD)`
process didn't exit successfully: `[..]/build-script-build` (exit code: 101)",
)).run();
).run();
}
#[test]
@ -179,11 +179,11 @@ fn custom_build_script_wrong_rustc_flags() {
p.cargo("build")
.with_status(101)
.with_stderr_contains(&format!(
.with_stderr_contains(
"\
[ERROR] Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 (CWD)`: \
`-aaa -bbb`",
)).run();
).run();
}
/*
@ -1669,7 +1669,7 @@ fn cfg_test() {
).file("tests/test.rs", "#[cfg(foo)] #[test] fn test_bar() {}")
.build();
p.cargo("test -v")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] [..] build.rs [..]
@ -1682,7 +1682,7 @@ fn cfg_test() {
[RUNNING] `[..]/test-[..][EXE]`
[DOCTEST] foo
[RUNNING] [..] --cfg foo[..]",
)).with_stdout_contains("test test_foo ... ok")
).with_stdout_contains("test test_foo ... ok")
.with_stdout_contains("test test_bar ... ok")
.with_stdout_contains_n("test [..] ... ok", 3)
.run();
@ -1774,7 +1774,7 @@ fn cfg_override_test() {
).file("tests/test.rs", "#[cfg(foo)] #[test] fn test_bar() {}")
.build();
p.cargo("test -v")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `[..]`
@ -1785,7 +1785,7 @@ fn cfg_override_test() {
[RUNNING] `[..]/test-[..][EXE]`
[DOCTEST] foo
[RUNNING] [..] --cfg foo[..]",
)).with_stdout_contains("test test_foo ... ok")
).with_stdout_contains("test test_foo ... ok")
.with_stdout_contains("test test_bar ... ok")
.with_stdout_contains_n("test [..] ... ok", 3)
.run();
@ -1897,7 +1897,7 @@ fn env_test() {
"#,
).build();
p.cargo("test -v")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] [..] build.rs [..]
@ -1910,7 +1910,7 @@ fn env_test() {
[RUNNING] `[..]/test-[..][EXE]`
[DOCTEST] foo
[RUNNING] [..] --crate-name foo[..]",
)).with_stdout_contains_n("running 0 tests", 2)
).with_stdout_contains_n("running 0 tests", 2)
.with_stdout_contains("test test_foo ... ok")
.run();
}

View file

@ -531,14 +531,13 @@ fn no_cross_doctests() {
"#,
).build();
let host_output = format!(
let host_output =
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[DOCTEST] foo
",
);
";
println!("a");
p.cargo("test").with_stderr(&host_output).run();

View file

@ -41,13 +41,13 @@ fn simple_cross_package() {
p.cargo("package --target")
.arg(&target)
.with_stderr(&format!(
.with_stderr(
" Packaging foo v0.0.0 (CWD)
Verifying foo v0.0.0 (CWD)
Compiling foo v0.0.0 (CWD/target/package/foo-0.0.0)
Finished dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
// Check that the tarball contains the files
let f = File::open(&p.root().join("target/package/foo-0.0.0.crate")).unwrap();

View file

@ -26,13 +26,13 @@ fn simple() {
.build();
p.cargo("doc")
.with_stderr(&format!(
.with_stderr(
"\
[..] foo v0.0.1 (CWD)
[..] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/doc").is_dir());
assert!(p.root().join("target/doc/foo/index.html").is_file());
}
@ -63,12 +63,12 @@ fn doc_twice() {
let p = project().file("src/lib.rs", "pub fn foo() {}").build();
p.cargo("doc")
.with_stderr(&format!(
.with_stderr(
"\
[DOCUMENTING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
p.cargo("doc").with_stdout("").run();
}
@ -93,14 +93,14 @@ fn doc_deps() {
.build();
p.cargo("doc")
.with_stderr(&format!(
.with_stderr(
"\
[..] bar v0.0.1 (CWD/bar)
[..] bar v0.0.1 (CWD/bar)
[DOCUMENTING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/doc").is_dir());
assert!(p.root().join("target/doc/foo/index.html").is_file());
@ -154,13 +154,13 @@ fn doc_no_deps() {
.build();
p.cargo("doc --no-deps")
.with_stderr(&format!(
.with_stderr(
"\
[CHECKING] bar v0.0.1 (CWD/bar)
[DOCUMENTING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/doc").is_dir());
assert!(p.root().join("target/doc/foo/index.html").is_file());
@ -369,12 +369,12 @@ fn doc_lib_bin_same_name_documents_lib() {
).build();
p.cargo("doc")
.with_stderr(&format!(
.with_stderr(
"\
[DOCUMENTING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/doc").is_dir());
let doc_file = p.root().join("target/doc/foo/index.html");
assert!(doc_file.is_file());
@ -408,12 +408,12 @@ fn doc_lib_bin_same_name_documents_lib_when_requested() {
).build();
p.cargo("doc --lib")
.with_stderr(&format!(
.with_stderr(
"\
[DOCUMENTING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/doc").is_dir());
let doc_file = p.root().join("target/doc/foo/index.html");
assert!(doc_file.is_file());
@ -447,13 +447,13 @@ fn doc_lib_bin_same_name_documents_named_bin_when_requested() {
).build();
p.cargo("doc --bin foo")
.with_stderr(&format!(
.with_stderr(
"\
[CHECKING] foo v0.0.1 (CWD)
[DOCUMENTING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/doc").is_dir());
let doc_file = p.root().join("target/doc/foo/index.html");
assert!(doc_file.is_file());
@ -487,13 +487,13 @@ fn doc_lib_bin_same_name_documents_bins_when_requested() {
).build();
p.cargo("doc --bins")
.with_stderr(&format!(
.with_stderr(
"\
[CHECKING] foo v0.0.1 (CWD)
[DOCUMENTING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/doc").is_dir());
let doc_file = p.root().join("target/doc/foo/index.html");
assert!(doc_file.is_file());

View file

@ -415,22 +415,22 @@ fn no_feature_doesnt_build() {
.build();
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
p.process(&p.bin("foo")).with_stdout("").run();
p.cargo("build --features bar")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] bar v0.0.1 (CWD/bar)
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
p.process(&p.bin("foo")).with_stdout("bar\n").run();
}
@ -467,22 +467,22 @@ fn default_feature_pulled_in() {
.build();
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] bar v0.0.1 (CWD/bar)
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
p.process(&p.bin("foo")).with_stdout("bar\n").run();
p.cargo("build --no-default-features")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
p.process(&p.bin("foo")).with_stdout("").run();
}
@ -575,14 +575,14 @@ fn groups_on_groups_on_groups() {
.build();
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] ba[..] v0.0.1 (CWD/ba[..])
[COMPILING] ba[..] v0.0.1 (CWD/ba[..])
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -621,14 +621,14 @@ fn many_cli_features() {
p.cargo("build --features")
.arg("bar baz")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] ba[..] v0.0.1 (CWD/ba[..])
[COMPILING] ba[..] v0.0.1 (CWD/ba[..])
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -698,14 +698,14 @@ fn union_features() {
).build();
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] d2 v0.0.1 (CWD/d2)
[COMPILING] d1 v0.0.1 (CWD/d1)
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -741,13 +741,13 @@ fn many_features_no_rebuilds() {
.build();
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] a v0.1.0 (CWD/a)
[COMPILING] b v0.1.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
p.root().move_into_the_past();
p.cargo("build -v")
@ -1197,14 +1197,14 @@ fn many_cli_features_comma_delimited() {
.build();
p.cargo("build --features bar,baz")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] ba[..] v0.0.1 (CWD/ba[..])
[COMPILING] ba[..] v0.0.1 (CWD/ba[..])
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -1259,7 +1259,7 @@ fn many_cli_features_comma_and_space_delimited() {
p.cargo("build --features")
.arg("bar,baz bam bap")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] ba[..] v0.0.1 (CWD/ba[..])
[COMPILING] ba[..] v0.0.1 (CWD/ba[..])
@ -1268,7 +1268,7 @@ fn many_cli_features_comma_and_space_delimited() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]

View file

@ -14,12 +14,12 @@ fn modifying_and_moving() {
.build();
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
p.cargo("build").with_stdout("").run();
p.root().move_into_the_past();
@ -30,12 +30,12 @@ fn modifying_and_moving() {
.write_all(b"#[allow(unused)]fn main() {}")
.unwrap();
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
fs::rename(&p.root().join("src/a.rs"), &p.root().join("src/b.rs")).unwrap();
p.cargo("build").with_status(101).run();
@ -52,12 +52,12 @@ fn modify_only_some_files() {
.build();
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
p.cargo("test").run();
sleep_ms(1000);
@ -78,12 +78,12 @@ fn modify_only_some_files() {
// Make sure the binary is rebuilt, not the lib
p.cargo("build")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.bin("foo").is_file());
}
@ -651,12 +651,12 @@ fn same_build_dir_cached_packages() {
)).run();
p.cargo("build")
.cwd(p.root().join("a2"))
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] a2 v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -746,13 +746,13 @@ fn rebuild_if_environment_changes() {
p.cargo("run")
.with_stdout("old desc")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/foo[EXE]`
",
)).run();
).run();
File::create(&p.root().join("Cargo.toml"))
.unwrap()
@ -768,13 +768,13 @@ fn rebuild_if_environment_changes() {
p.cargo("run")
.with_stdout("new desc")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/foo[EXE]`
",
)).run();
).run();
}
#[test]

View file

@ -1399,12 +1399,12 @@ fn git_build_cmd_freshness() {
sleep_ms(1000);
foo.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
// Smoke test to make sure it doesn't compile again
println!("first pass");

View file

@ -769,10 +769,10 @@ fn uninstall_cwd_not_installed() {
p.cargo("uninstall")
.with_status(101)
.with_stdout("")
.with_stderr(format!(
.with_stderr(
"\
error: package `foo v0.0.1 (CWD)` is not installed",
)).run();
).run();
}
#[test]

View file

@ -46,14 +46,14 @@ fn simple() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UNPACKING] bar v0.0.1 ([..])
[COMPILING] bar v0.0.1
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] [..]
",
)).run();
).run();
p.cargo("build").with_stderr("[FINISHED] [..]").run();
p.cargo("test").run();
}
@ -85,14 +85,14 @@ fn multiple_versions() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UNPACKING] bar v0.1.0 ([..])
[COMPILING] bar v0.1.0
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] [..]
",
)).run();
).run();
Package::new("bar", "0.2.0")
.local(true)
@ -142,7 +142,7 @@ fn multiple_names() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UNPACKING] [..]
[UNPACKING] [..]
@ -151,7 +151,7 @@ fn multiple_names() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] [..]
",
)).run();
).run();
}
#[test]
@ -193,7 +193,7 @@ fn interdependent() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UNPACKING] [..]
[UNPACKING] [..]
@ -202,7 +202,7 @@ fn interdependent() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] [..]
",
)).run();
).run();
}
#[test]
@ -257,7 +257,7 @@ fn path_dep_rewritten() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UNPACKING] [..]
[UNPACKING] [..]
@ -266,7 +266,7 @@ fn path_dep_rewritten() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] [..]
",
)).run();
).run();
}
#[test]
@ -409,14 +409,14 @@ fn crates_io_registry_url_is_optional() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UNPACKING] bar v0.0.1 ([..])
[COMPILING] bar v0.0.1
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] [..]
",
)).run();
).run();
p.cargo("build").with_stderr("[FINISHED] [..]").run();
p.cargo("test").run();
}

View file

@ -27,7 +27,7 @@ fn simple() {
.build();
p.cargo("package")
.with_stderr(&format!(
.with_stderr(
"\
[WARNING] manifest has no documentation[..]
See [..]
@ -36,7 +36,7 @@ See [..]
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
p.cargo("package -l")
.with_stdout(
@ -70,7 +70,7 @@ src/main.rs
fn metadata_warning() {
let p = project().file("src/main.rs", "fn main() {}").build();
p.cargo("package")
.with_stderr(&format!(
.with_stderr(
"\
warning: manifest has no description, license, license-file, documentation, \
homepage or repository.
@ -80,7 +80,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
let p = project()
.file(
@ -95,7 +95,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
).file("src/main.rs", "fn main() {}")
.build();
p.cargo("package")
.with_stderr(&format!(
.with_stderr(
"\
warning: manifest has no description, documentation, homepage or repository.
See http://doc.crates.io/manifest.html#package-metadata for more info.
@ -104,7 +104,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
let p = project()
.file(
@ -121,14 +121,14 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
).file("src/main.rs", "fn main() {}")
.build();
p.cargo("package")
.with_stderr(&format!(
.with_stderr(
"\
[PACKAGING] foo v0.0.1 (CWD)
[VERIFYING] foo v0.0.1 (CWD)
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -202,7 +202,7 @@ fn package_verification() {
let p = project().file("src/main.rs", "fn main() {}").build();
p.cargo("build").run();
p.cargo("package")
.with_stderr(&format!(
.with_stderr(
"\
[WARNING] manifest has no description[..]
See http://doc.crates.io/manifest.html#package-metadata for more info.
@ -211,7 +211,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -242,12 +242,12 @@ fn vcs_file_collision() {
p.cargo("package")
.arg("--no-verify")
.with_status(101)
.with_stderr(&format!(
.with_stderr(
"\
[ERROR] Invalid inclusion of reserved file name .cargo_vcs_info.json \
in package source
",
)).run();
).run();
}
#[test]
@ -541,7 +541,7 @@ fn ignore_nested() {
.build();
p.cargo("package")
.with_stderr(&format!(
.with_stderr(
"\
[WARNING] manifest has no documentation[..]
See http://doc.crates.io/manifest.html#package-metadata for more info.
@ -550,7 +550,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
p.cargo("package -l")
.with_stdout(
@ -627,7 +627,7 @@ fn repackage_on_source_change() {
// Check that cargo rebuilds the tarball
cargo_process("package")
.cwd(p.root())
.with_stderr(&format!(
.with_stderr(
"\
[WARNING] [..]
See [..]
@ -636,7 +636,7 @@ See [..]
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
// Check that the tarball contains the added file
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
@ -1100,7 +1100,7 @@ fn package_lockfile() {
p.cargo("package")
.masquerade_as_nightly_cargo()
.with_stderr(&format!(
.with_stderr(
"\
[WARNING] manifest has no documentation[..]
See [..]
@ -1109,7 +1109,7 @@ See [..]
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
p.cargo("package -l")
.masquerade_as_nightly_cargo()

View file

@ -64,13 +64,13 @@ fn cargo_compile_with_nested_deps_shorthand() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] baz v0.5.0 (CWD/bar/baz)\n\
[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
assert!(p.bin("foo").is_file());
@ -80,19 +80,19 @@ fn cargo_compile_with_nested_deps_shorthand() {
p.cargo("clean -v").with_stdout("").run();
println!("building baz");
p.cargo("build -p baz")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] baz v0.5.0 (CWD/bar/baz)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
println!("building foo");
p.cargo("build -p foo")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
}
#[test]
@ -222,12 +222,12 @@ fn cargo_compile_with_transitive_dev_deps() {
).build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) in \
[..]\n",
)).run();
).run();
assert!(p.bin("foo").is_file());
@ -255,12 +255,12 @@ fn no_rebuild_dependency() {
.build();
// First time around we should compile both foo and bar
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
sleep_ms(1000);
p.change_file(
@ -317,13 +317,13 @@ fn deep_dependencies_trigger_rebuild() {
.file("baz/src/baz.rs", "pub fn baz() {}")
.build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] baz v0.5.0 (CWD/baz)\n\
[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
p.cargo("build").with_stdout("").run();
// Make sure an update to baz triggers a rebuild of bar
@ -336,13 +336,13 @@ fn deep_dependencies_trigger_rebuild() {
.unwrap();
sleep_ms(1000);
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] baz v0.5.0 (CWD/baz)\n\
[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
// Make sure an update to bar doesn't trigger baz
File::create(&p.root().join("bar/src/bar.rs"))
@ -355,12 +355,12 @@ fn deep_dependencies_trigger_rebuild() {
).unwrap();
sleep_ms(1000);
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
}
#[test]
@ -400,13 +400,13 @@ fn no_rebuild_two_deps() {
.file("baz/src/baz.rs", "pub fn baz() {}")
.build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] baz v0.5.0 (CWD/baz)\n\
[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
assert!(p.bin("foo").is_file());
p.cargo("build").with_stdout("").run();
assert!(p.bin("foo").is_file());
@ -435,12 +435,12 @@ fn nested_deps_recompile() {
.build();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] bar v0.5.0 (CWD/src/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
sleep_ms(1000);
File::create(&p.root().join("src/main.rs"))
@ -450,11 +450,11 @@ fn nested_deps_recompile() {
// This shouldn't recompile `bar`
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
}
#[test]
@ -660,12 +660,12 @@ fn path_dep_build_cmd() {
p.root().join("bar").move_into_the_past();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) in \
[..]\n",
)).run();
).run();
assert!(p.bin("foo").is_file());
@ -680,12 +680,12 @@ fn path_dep_build_cmd() {
}
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] bar v0.5.0 (CWD/bar)\n\
[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) in \
[..]\n",
)).run();
).run();
p.process(&p.bin("foo")).with_stdout("1\n").run();
}
@ -719,20 +719,20 @@ fn dev_deps_no_rebuild_lib() {
.build();
p.cargo("build")
.env("FOO", "bar")
.with_stderr(&format!(
.with_stderr(
"[COMPILING] foo v0.5.0 (CWD)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
in [..]\n",
)).run();
).run();
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] [..] v0.5.0 (CWD[..])
[COMPILING] [..] v0.5.0 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
)).with_stdout_contains("running 0 tests")
).with_stdout_contains("running 0 tests")
.run();
}

View file

@ -23,7 +23,7 @@ fn profile_overrides() {
).file("src/lib.rs", "")
.build();
p.cargo("build -v")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] test v0.0.0 (CWD)
[RUNNING] `rustc --crate-name test src/lib.rs --crate-type lib \
@ -36,7 +36,7 @@ fn profile_overrides() {
-L dependency=CWD/target/debug/deps`
[FINISHED] dev [optimized] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -57,7 +57,7 @@ fn opt_level_override_0() {
).file("src/lib.rs", "")
.build();
p.cargo("build -v")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] test v0.0.0 (CWD)
[RUNNING] `rustc --crate-name test src/lib.rs --crate-type lib \
@ -68,7 +68,7 @@ fn opt_level_override_0() {
-L dependency=CWD/target/debug/deps`
[FINISHED] [..] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -88,7 +88,7 @@ fn debug_override_1() {
).file("src/lib.rs", "")
.build();
p.cargo("build -v")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] test v0.0.0 (CWD)
[RUNNING] `rustc --crate-name test src/lib.rs --crate-type lib \
@ -99,7 +99,7 @@ fn debug_override_1() {
-L dependency=CWD/target/debug/deps`
[FINISHED] [..] target(s) in [..]
",
)).run();
).run();
}
fn check_opt_level_override(profile_level: &str, rustc_level: &str) {

View file

@ -599,7 +599,7 @@ fn dry_run() {
p.cargo("publish --dry-run --index")
.arg(publish::registry().to_string())
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] registry `[..]`
[WARNING] manifest has no documentation, [..]
@ -611,7 +611,7 @@ See [..]
[UPLOADING] foo v0.0.1 (CWD)
[WARNING] aborting upload due to dry run
",
)).run();
).run();
// Ensure the API request wasn't actually made
assert!(!publish::upload_path().join("api/v1/crates/new").exists());

View file

@ -52,13 +52,13 @@ fn simple() {
// Don't download a second time
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] bar v0.0.1
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
}
#[test]
@ -309,7 +309,7 @@ required by package `foo v0.0.1 ([..])`
Package::new("notyet", "0.0.1").publish();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(format!(
"\
[UPDATING] registry `{reg}`
[DOWNLOADING] notyet v0.0.1 (registry `file://[..]`)
@ -362,7 +362,7 @@ required by package `foo v0.0.1 ([..])`
Package::new("notyet", "0.0.1").publish();
p.cargo("package")
.with_stderr(format!(
.with_stderr(
"\
[PACKAGING] foo v0.0.1 (CWD)
[VERIFYING] foo v0.0.1 (CWD)
@ -372,7 +372,7 @@ required by package `foo v0.0.1 ([..])`
[COMPILING] foo v0.0.1 (CWD[..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
}
#[test]
@ -395,7 +395,7 @@ fn lockfile_locks() {
Package::new("bar", "0.0.1").publish();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] registry `[..]`
[DOWNLOADING] bar v0.0.1 (registry `file://[..]`)
@ -403,7 +403,7 @@ fn lockfile_locks() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
p.root().move_into_the_past();
Package::new("bar", "0.0.2").publish();
@ -432,7 +432,7 @@ fn lockfile_locks_transitively() {
Package::new("bar", "0.0.1").dep("baz", "*").publish();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] registry `[..]`
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
@ -442,7 +442,7 @@ fn lockfile_locks_transitively() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
p.root().move_into_the_past();
Package::new("baz", "0.0.2").publish();
@ -477,7 +477,7 @@ fn yanks_are_not_used() {
.publish();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] registry `[..]`
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
@ -487,7 +487,7 @@ fn yanks_are_not_used() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
}
#[test]
@ -628,14 +628,14 @@ fn update_lockfile() {
println!("0.0.2 build");
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[DOWNLOADING] [..] v0.0.2 (registry `file://[..]`)
[COMPILING] bar v0.0.2
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
println!("0.0.3 update");
p.cargo("update -p bar")
@ -648,14 +648,14 @@ fn update_lockfile() {
println!("0.0.3 build");
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[DOWNLOADING] [..] v0.0.3 (registry `file://[..]`)
[COMPILING] bar v0.0.3
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
println!("new dependencies update");
Package::new("bar", "0.0.4").dep("spam", "0.2.5").publish();
@ -725,7 +725,7 @@ fn dev_dependency_not_used() {
Package::new("bar", "0.0.1").dev_dep("baz", "*").publish();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] registry `[..]`
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
@ -733,7 +733,7 @@ fn dev_dependency_not_used() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
}
#[test]
@ -809,7 +809,7 @@ fn updating_a_dep() {
Package::new("bar", "0.0.1").publish();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] registry `[..]`
[DOWNLOADING] bar v0.0.1 (registry `file://[..]`)
@ -818,7 +818,7 @@ fn updating_a_dep() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
t!(t!(File::create(&p.root().join("a/Cargo.toml"))).write_all(
br#"
@ -835,7 +835,7 @@ fn updating_a_dep() {
println!("second");
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] registry `[..]`
[DOWNLOADING] bar v0.1.0 (registry `file://[..]`)
@ -844,7 +844,7 @@ fn updating_a_dep() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
}
#[test]
@ -888,7 +888,7 @@ fn git_and_registry_dep() {
p.root().move_into_the_past();
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] [..]
[UPDATING] [..]
@ -898,7 +898,7 @@ fn git_and_registry_dep() {
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
p.root().move_into_the_past();
println!("second");
@ -962,7 +962,7 @@ fn update_publish_then_update() {
// should force an update of the old registry, download the new crate, and
// then build everything again.
p.cargo("build")
.with_stderr(&format!(
.with_stderr(
"\
[UPDATING] [..]
[DOWNLOADING] a v0.1.1 (registry `file://[..]`)
@ -970,7 +970,7 @@ fn update_publish_then_update() {
[COMPILING] foo v0.5.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
",
)).run();
).run();
}
#[test]

View file

@ -328,7 +328,7 @@ fn can_run_doc_tests() {
foo.cargo("test -v")
.masquerade_as_nightly_cargo()
.with_stderr_contains(format!(
.with_stderr_contains(
"\
[DOCTEST] foo
[RUNNING] `rustdoc --test CWD/src/lib.rs \
@ -337,7 +337,7 @@ fn can_run_doc_tests() {
--extern bar=CWD/target/debug/deps/libbar-[..].rlib \
[..]`
",
)).run();
).run();
}
#[test]

View file

@ -272,12 +272,12 @@ fn test_default_features() {
.build();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
)).with_stdout_contains("test test ... ok")
).with_stdout_contains("test test ... ok")
.run();
p.cargo("test --no-default-features")
@ -325,12 +325,12 @@ fn test_arg_features() {
.build();
p.cargo("test --features a")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
)).with_stdout_contains("test test ... ok")
).with_stdout_contains("test test ... ok")
.run();
}
@ -364,22 +364,22 @@ fn test_multiple_required_features() {
.build();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo_2-[..][EXE]",
)).with_stdout_contains("test test ... ok")
).with_stdout_contains("test test ... ok")
.run();
p.cargo("test --features c")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo_1-[..][EXE]
[RUNNING] target/debug/deps/foo_2-[..][EXE]",
)).with_stdout_contains_n("test test ... ok", 2)
).with_stdout_contains_n("test test ... ok", 2)
.run();
p.cargo("test --no-default-features")
@ -423,12 +423,12 @@ fn bench_default_features() {
).build();
p.cargo("bench")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]",
)).with_stdout_contains("test bench ... bench: [..]")
).with_stdout_contains("test bench ... bench: [..]")
.run();
p.cargo("bench --no-default-features")
@ -488,12 +488,12 @@ fn bench_arg_features() {
).build();
p.cargo("bench --features a")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]",
)).with_stdout_contains("test bench ... bench: [..]")
).with_stdout_contains("test bench ... bench: [..]")
.run();
}
@ -547,22 +547,22 @@ fn bench_multiple_required_features() {
).build();
p.cargo("bench")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo_2-[..][EXE]",
)).with_stdout_contains("test bench ... bench: [..]")
).with_stdout_contains("test bench ... bench: [..]")
.run();
p.cargo("bench --features c")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo_1-[..][EXE]
[RUNNING] target/release/deps/foo_2-[..][EXE]",
)).with_stdout_contains_n("test bench ... bench: [..]", 2)
).with_stdout_contains_n("test bench ... bench: [..]", 2)
.run();
p.cargo("bench --no-default-features")
@ -800,12 +800,12 @@ fn dep_feature_in_toml() {
// test
p.cargo("test --test=foo")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
)).with_stdout_contains("test test ... ok")
).with_stdout_contains("test test ... ok")
.run();
// bench
@ -918,12 +918,12 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"`
.run();
p.cargo("test --test=foo --features bar/a")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
)).with_stdout_contains("test test ... ok")
).with_stdout_contains("test test ... ok")
.run();
// bench
@ -986,21 +986,21 @@ fn test_skips_compiling_bin_with_missing_required_features() {
.build();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
)).with_stdout_contains("running 0 tests")
).with_stdout_contains("running 0 tests")
.run();
p.cargo("test --features a -j 1")
.with_status(101)
.with_stderr_contains(format!(
.with_stderr_contains(
"\
[COMPILING] foo v0.0.1 (CWD)
error[E0463]: can't find crate for `bar`",
)).run();
).run();
if is_nightly() {
p.cargo("bench")

View file

@ -9,12 +9,12 @@ fn simple() {
.build();
p.cargo("run")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/foo[EXE]`",
)).with_stdout("hello")
).with_stdout("hello")
.run();
assert!(p.bin("foo").is_file());
}
@ -179,14 +179,14 @@ fn specify_name() {
).build();
p.cargo("run --bin a -v")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc [..] src/lib.rs [..]`
[RUNNING] `rustc [..] src/bin/a.rs [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/a[EXE]`",
)).with_stdout("hello a.rs")
).with_stdout("hello a.rs")
.run();
p.cargo("run --bin b -v")
@ -316,12 +316,12 @@ fn run_example() {
.build();
p.cargo("run --example a")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/examples/a[EXE]`",
)).with_stdout("example")
).with_stdout("example")
.run();
}
@ -428,12 +428,12 @@ fn run_example_autodiscover_2015_with_autoexamples_enabled() {
let p = autodiscover_examples_project("2015", Some(true));
p.cargo("run --example a")
.masquerade_as_nightly_cargo()
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/examples/a[EXE]`",
)).with_stdout("example")
).with_stdout("example")
.run();
}
@ -460,12 +460,12 @@ fn run_example_autodiscover_2018() {
let p = autodiscover_examples_project("2018", None);
p.cargo("run --example a")
.masquerade_as_nightly_cargo()
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/examples/a[EXE]`",
)).with_stdout("example")
).with_stdout("example")
.run();
}
@ -554,12 +554,12 @@ fn one_bin_multiple_examples() {
.build();
p.cargo("run")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/main[EXE]`",
)).with_stdout("hello main.rs")
).with_stdout("hello main.rs")
.run();
}
@ -607,7 +607,7 @@ fn example_with_release_flag() {
).build();
p.cargo("run -v --release --example a")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] bar v0.5.0 (CWD/bar)
[RUNNING] `rustc --crate-name bar bar/src/bar.rs --crate-type lib \
@ -627,14 +627,14 @@ fn example_with_release_flag() {
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] `target/release/examples/a[EXE]`
",
)).with_stdout(
).with_stdout(
"\
fast1
fast2",
).run();
p.cargo("run -v --example a")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] bar v0.5.0 (CWD/bar)
[RUNNING] `rustc --crate-name bar bar/src/bar.rs --crate-type lib \
@ -654,7 +654,7 @@ fast2",
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/examples/a[EXE]`
",
)).with_stdout(
).with_stdout(
"\
slow1
slow2",
@ -707,13 +707,13 @@ fn release_works() {
).build();
p.cargo("run --release")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] `target/release/foo[EXE]`
",
)).run();
).run();
assert!(p.release_bin("foo").is_file());
}

View file

@ -12,7 +12,7 @@ fn build_lib_for_foo() {
.build();
p.cargo("rustc --lib -v")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \
@ -22,7 +22,7 @@ fn build_lib_for_foo() {
-L dependency=CWD/target/debug/deps`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -33,7 +33,7 @@ fn lib() {
.build();
p.cargo("rustc --lib -v -- -C debug-assertions=off")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \
@ -44,7 +44,7 @@ fn lib() {
-L dependency=CWD/target/debug/deps`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -55,7 +55,7 @@ fn build_main_and_allow_unstable_options() {
.build();
p.cargo("rustc -v --bin foo -- -C debug-assertions")
.with_stderr(&format!(
.with_stderr(format!(
"\
[COMPILING] {name} v{version} (CWD)
[RUNNING] `rustc --crate-name {name} src/lib.rs --crate-type lib \
@ -100,7 +100,7 @@ fn build_with_args_to_one_of_multiple_binaries() {
.build();
p.cargo("rustc -v --bin bar -- -C debug-assertions")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib --emit=dep-info,link \
@ -110,7 +110,7 @@ fn build_with_args_to_one_of_multiple_binaries() {
-C debuginfo=2 -C debug-assertions [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -138,7 +138,7 @@ fn build_with_args_to_one_of_multiple_tests() {
.build();
p.cargo("rustc -v --test bar -- -C debug-assertions")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib --emit=dep-info,link \
@ -148,7 +148,7 @@ fn build_with_args_to_one_of_multiple_tests() {
-C debug-assertions [..]--test[..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -174,7 +174,7 @@ fn build_foo_with_bar_dependency() {
.build();
foo.cargo("rustc -v -- -C debug-assertions")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] bar v0.1.0 ([..])
[RUNNING] `[..] -C debuginfo=2 [..]`
@ -182,7 +182,7 @@ fn build_foo_with_bar_dependency() {
[RUNNING] `[..] -C debuginfo=2 -C debug-assertions [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]

View file

@ -5,7 +5,7 @@ fn rustdoc_simple() {
let p = project().file("src/lib.rs", "").build();
p.cargo("rustdoc -v")
.with_stderr(format!(
.with_stderr(
"\
[DOCUMENTING] foo v0.0.1 (CWD)
[RUNNING] `rustdoc --crate-name foo src/lib.rs \
@ -13,7 +13,7 @@ fn rustdoc_simple() {
-L dependency=CWD/target/debug/deps`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -21,7 +21,7 @@ fn rustdoc_args() {
let p = project().file("src/lib.rs", "").build();
p.cargo("rustdoc -v -- --cfg=foo")
.with_stderr(format!(
.with_stderr(
"\
[DOCUMENTING] foo v0.0.1 (CWD)
[RUNNING] `rustdoc --crate-name foo src/lib.rs \
@ -30,7 +30,7 @@ fn rustdoc_args() {
-L dependency=CWD/target/debug/deps`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -56,7 +56,7 @@ fn rustdoc_foo_with_bar_dependency() {
.build();
foo.cargo("rustdoc -v -- --cfg=foo")
.with_stderr(format!(
.with_stderr(
"\
[CHECKING] bar v0.0.1 ([..])
[RUNNING] `rustc [..]bar/src/lib.rs [..]`
@ -68,7 +68,7 @@ fn rustdoc_foo_with_bar_dependency() {
--extern [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -94,7 +94,7 @@ fn rustdoc_only_bar_dependency() {
.build();
foo.cargo("rustdoc -v -p bar -- --cfg=foo")
.with_stderr(format!(
.with_stderr(
"\
[DOCUMENTING] bar v0.0.1 ([..])
[RUNNING] `rustdoc --crate-name bar [..]bar/src/lib.rs \
@ -103,7 +103,7 @@ fn rustdoc_only_bar_dependency() {
-L dependency=CWD/target/debug/deps`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -114,7 +114,7 @@ fn rustdoc_same_name_documents_lib() {
.build();
p.cargo("rustdoc -v -- --cfg=foo")
.with_stderr(format!(
.with_stderr(
"\
[DOCUMENTING] foo v0.0.1 ([..])
[RUNNING] `rustdoc --crate-name foo src/lib.rs \
@ -123,7 +123,7 @@ fn rustdoc_same_name_documents_lib() {
-L dependency=CWD/target/debug/deps`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]

View file

@ -34,12 +34,12 @@ fn cargo_test_simple() {
p.process(&p.bin("foo")).with_stdout("hello\n").run();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
)).with_stdout_contains("test test_hello ... ok")
).with_stdout_contains("test test_hello ... ok")
.run();
}
@ -79,7 +79,7 @@ fn cargo_test_release() {
.build();
p.cargo("test -v --release")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] bar v0.0.1 (CWD/bar)
[RUNNING] [..] -C opt-level=3 [..]
@ -92,7 +92,7 @@ fn cargo_test_release() {
[RUNNING] `[..]target/release/deps/test-[..][EXE]`
[DOCTEST] foo
[RUNNING] `rustdoc --test [..]lib.rs[..]`",
)).with_stdout_contains_n("test test ... ok", 2)
).with_stdout_contains_n("test test ... ok", 2)
.with_stdout_contains("running 0 tests")
.run();
}
@ -148,13 +148,13 @@ fn cargo_test_verbose() {
).build();
p.cargo("test -v hello")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[RUNNING] `rustc [..] src/main.rs [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `[..]target/debug/deps/foo-[..][EXE] hello`",
)).with_stdout_contains("test test_hello ... ok")
).with_stdout_contains("test test_hello ... ok")
.run();
}
@ -216,13 +216,13 @@ fn cargo_test_failing_test_in_bin() {
p.process(&p.bin("foo")).with_stdout("hello\n").run();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[ERROR] test failed, to rerun pass '--bin foo'",
)).with_stdout_contains(
).with_stdout_contains(
"
running 1 test
test test_hello ... FAILED
@ -260,14 +260,14 @@ fn cargo_test_failing_test_in_test() {
p.process(&p.bin("foo")).with_stdout("hello\n").run();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[RUNNING] target/debug/deps/footest-[..][EXE]
[ERROR] test failed, to rerun pass '--test footest'",
)).with_stdout_contains("running 0 tests")
).with_stdout_contains("running 0 tests")
.with_stdout_contains(
"\
running 1 test
@ -296,13 +296,13 @@ fn cargo_test_failing_test_in_lib() {
.build();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[ERROR] test failed, to rerun pass '--lib'",
)).with_stdout_contains(
).with_stdout_contains(
"\
test test_hello ... FAILED
@ -364,14 +364,14 @@ fn test_with_lib_dep() {
).build();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[RUNNING] target/debug/deps/baz-[..][EXE]
[DOCTEST] foo",
)).with_stdout_contains("test lib_test ... ok")
).with_stdout_contains("test lib_test ... ok")
.with_stdout_contains("test bin_test ... ok")
.with_stdout_contains_n("test [..] ... ok", 3)
.run();
@ -414,14 +414,14 @@ fn test_with_deep_lib_dep() {
.build();
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] bar v0.0.1 ([..])
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[..]
[DOCTEST] foo",
)).with_stdout_contains("test bar_test ... ok")
).with_stdout_contains("test bar_test ... ok")
.with_stdout_contains_n("test [..] ... ok", 2)
.run();
}
@ -460,14 +460,14 @@ fn external_test_explicit() {
).build();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[RUNNING] target/debug/deps/test-[..][EXE]
[DOCTEST] foo",
)).with_stdout_contains("test internal_test ... ok")
).with_stdout_contains("test internal_test ... ok")
.with_stdout_contains("test external_test ... ok")
.with_stdout_contains("running 0 tests")
.run();
@ -516,14 +516,14 @@ fn external_test_implicit() {
).build();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[RUNNING] target/debug/deps/external-[..][EXE]
[DOCTEST] foo",
)).with_stdout_contains("test internal_test ... ok")
).with_stdout_contains("test internal_test ... ok")
.with_stdout_contains("test external_test ... ok")
.with_stdout_contains("running 0 tests")
.run();
@ -554,13 +554,13 @@ fn pass_through_command_line() {
).build();
p.cargo("test bar")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[DOCTEST] foo",
)).with_stdout_contains("test bar ... ok")
).with_stdout_contains("test bar ... ok")
.with_stdout_contains("running 0 tests")
.run();
@ -625,14 +625,14 @@ fn lib_bin_same_name() {
).build();
p.cargo("test")
.with_stderr(format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[RUNNING] target/debug/deps/foo-[..][EXE]
[DOCTEST] foo",
)).with_stdout_contains_n("test [..] ... ok", 2)
).with_stdout_contains_n("test [..] ... ok", 2)
.with_stdout_contains("running 0 tests")
.run();
}
@ -663,14 +663,14 @@ fn lib_with_standard_name() {
).build();
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] syntax v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/syntax-[..][EXE]
[RUNNING] target/debug/deps/test-[..][EXE]
[DOCTEST] syntax",
)).with_stdout_contains("test foo_test ... ok")
).with_stdout_contains("test foo_test ... ok")
.with_stdout_contains("test test ... ok")
.with_stdout_contains_n("test [..] ... ok", 3)
.run();
@ -706,12 +706,12 @@ fn lib_with_standard_name2() {
).build();
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] syntax v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/syntax-[..][EXE]",
)).with_stdout_contains("test test ... ok")
).with_stdout_contains("test test ... ok")
.run();
}
@ -744,12 +744,12 @@ fn lib_without_name() {
).build();
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] syntax v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/syntax-[..][EXE]",
)).with_stdout_contains("test test ... ok")
).with_stdout_contains("test test ... ok")
.run();
}
@ -1032,14 +1032,14 @@ fn test_dylib() {
.build();
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] bar v0.0.1 (CWD/bar)
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[RUNNING] target/debug/deps/test-[..][EXE]",
)).with_stdout_contains_n("test foo ... ok", 2)
).with_stdout_contains_n("test foo ... ok", 2)
.run();
p.root().move_into_the_past();
@ -1070,13 +1070,13 @@ fn test_twice_with_build_cmd() {
.build();
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[DOCTEST] foo",
)).with_stdout_contains("test foo ... ok")
).with_stdout_contains("test foo ... ok")
.with_stdout_contains("running 0 tests")
.run();
@ -1096,13 +1096,13 @@ fn test_then_build() {
let p = project().file("src/lib.rs", "#[test] fn foo() {}").build();
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]
[DOCTEST] foo",
)).with_stdout_contains("test foo ... ok")
).with_stdout_contains("test foo ... ok")
.with_stdout_contains("running 0 tests")
.run();
@ -1116,12 +1116,12 @@ fn test_no_run() {
.build();
p.cargo("test --no-run")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -1382,13 +1382,13 @@ fn test_no_harness() {
.build();
p.cargo("test -- --nocapture")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/bar-[..][EXE]
",
)).run();
).run();
}
#[test]
@ -1449,34 +1449,34 @@ fn selective_testing() {
println!("d1");
p.cargo("test -p d1")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] d1 v0.0.1 (CWD/d1)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/d1-[..][EXE]
[RUNNING] target/debug/deps/d1-[..][EXE]",
)).with_stdout_contains_n("running 0 tests", 2)
).with_stdout_contains_n("running 0 tests", 2)
.run();
println!("d2");
p.cargo("test -p d2")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] d2 v0.0.1 (CWD/d2)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/d2-[..][EXE]
[RUNNING] target/debug/deps/d2-[..][EXE]",
)).with_stdout_contains_n("running 0 tests", 2)
).with_stdout_contains_n("running 0 tests", 2)
.run();
println!("whole");
p.cargo("test")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
)).with_stdout_contains("running 0 tests")
).with_stdout_contains("running 0 tests")
.run();
}
@ -1639,13 +1639,13 @@ fn selective_testing_with_docs() {
let p = p.build();
p.cargo("test -p d1")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] d1 v0.0.1 (CWD/d1)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/d1[..][EXE]
[DOCTEST] d1",
)).with_stdout_contains_n("running 0 tests", 2)
).with_stdout_contains_n("running 0 tests", 2)
.run();
}
@ -1657,14 +1657,14 @@ fn example_bin_same_name() {
.build();
p.cargo("test --no-run -v")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc [..]`
[RUNNING] `rustc [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
assert!(!p.bin("foo").is_file());
assert!(p.bin("examples/foo").is_file());

View file

@ -21,13 +21,13 @@ fn pathless_tools() {
).build();
foo.cargo("build --verbose")
.with_stderr(&format!(
.with_stderr(
"\
[COMPILING] foo v0.5.0 (CWD)
[RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)).run();
).run();
}
#[test]
@ -136,28 +136,28 @@ fn custom_runner() {
p.cargo("run -- --param")
.with_status(101)
.with_stderr_contains(&format!(
.with_stderr_contains(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `nonexistent-runner -r target/debug/foo[EXE] --param`
",
)).run();
).run();
p.cargo("test --test test --verbose -- --param")
.with_status(101)
.with_stderr_contains(&format!(
.with_stderr_contains(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `nonexistent-runner -r [..]/target/debug/deps/test-[..][EXE] --param`
",
)).run();
).run();
p.cargo("bench --bench bench --verbose -- --param")
.with_status(101)
.with_stderr_contains(&format!(
.with_stderr_contains(
"\
[COMPILING] foo v0.0.1 (CWD)
[RUNNING] `rustc [..]`
@ -165,5 +165,5 @@ fn custom_runner() {
[FINISHED] release [optimized] target(s) in [..]
[RUNNING] `nonexistent-runner -r [..]/target/release/deps/bench-[..][EXE] --param --bench`
",
)).run();
).run();
}