From ac3a8579db95364e95e83ded86afcd8f6af3b91a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 12 May 2016 20:06:36 +0300 Subject: [PATCH] remove useless formats --- tests/test_bad_manifest_path.rs | 4 +- tests/test_cargo.rs | 8 +- tests/test_cargo_bench.rs | 24 ++--- tests/test_cargo_build_lib.rs | 2 +- tests/test_cargo_cfg.rs | 16 +-- tests/test_cargo_clean.rs | 8 +- tests/test_cargo_compile.rs | 86 ++++++++-------- tests/test_cargo_compile_custom_build.rs | 124 +++++++++++------------ tests/test_cargo_compile_git_deps.rs | 36 +++---- tests/test_cargo_compile_path_deps.rs | 24 ++--- tests/test_cargo_compile_plugins.rs | 4 +- tests/test_cargo_concurrent.rs | 12 +-- tests/test_cargo_cross_compile.rs | 12 +-- tests/test_cargo_doc.rs | 12 +-- tests/test_cargo_features.rs | 52 +++++----- tests/test_cargo_freshness.rs | 4 +- tests/test_cargo_init.rs | 20 ++-- tests/test_cargo_install.rs | 48 ++++----- tests/test_cargo_metadata.rs | 12 +-- tests/test_cargo_new.rs | 16 +-- tests/test_cargo_overrides.rs | 32 +++--- tests/test_cargo_package.rs | 8 +- tests/test_cargo_publish.rs | 12 +-- tests/test_cargo_read_manifest.rs | 8 +- tests/test_cargo_registry.rs | 104 +++++++++---------- tests/test_cargo_run.rs | 40 ++++---- tests/test_cargo_rustc.rs | 20 ++-- tests/test_cargo_rustdoc.rs | 4 +- tests/test_cargo_search.rs | 8 +- tests/test_cargo_test.rs | 84 +++++++-------- 30 files changed, 421 insertions(+), 423 deletions(-) diff --git a/tests/test_bad_manifest_path.rs b/tests/test_bad_manifest_path.rs index ed6fc7c9a..9c95fa8ab 100644 --- a/tests/test_bad_manifest_path.rs +++ b/tests/test_bad_manifest_path.rs @@ -12,8 +12,8 @@ fn assert_not_a_cargo_toml(command: &str, manifest_path_argument: &str) { .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 diff --git a/tests/test_cargo.rs b/tests/test_cargo.rs index 222d7bce3..cbc6f9d75 100644 --- a/tests/test_cargo.rs +++ b/tests/test_cargo.rs @@ -102,11 +102,11 @@ test!(find_closest_biuld_to_build { assert_that(pr, execs().with_status(101) - .with_stderr(&format!("[ERROR] no such subcommand + .with_stderr("[ERROR] no such subcommand Did you mean `build`? -"))); +")); }); // if a subcommand is more than 3 edit distance away, we don't make a suggestion @@ -117,8 +117,8 @@ test!(find_closest_dont_correct_nonsense { assert_that(pr, execs().with_status(101) - .with_stderr(&format!("[ERROR] no such subcommand -"))); + .with_stderr("[ERROR] no such subcommand +")); }); test!(override_cargo_home { diff --git a/tests/test_cargo_bench.rs b/tests/test_cargo_bench.rs index b6e735e4a..b75207a4c 100644 --- a/tests/test_cargo_bench.rs +++ b/tests/test_cargo_bench.rs @@ -460,7 +460,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured assert_that(p.cargo("bench").arg("foo"), execs().with_status(0) - .with_stdout(&format!("\ + .with_stdout("\ [RUNNING] target[..]release[..]foo-[..] running 1 test @@ -468,7 +468,7 @@ test foo ... bench: [..] 0 ns/iter (+/- 0) test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured -"))); +")); }); // Regression test for running cargo-bench twice with @@ -776,7 +776,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured assert_that(p.cargo("bench"), execs().with_status(0) - .with_stdout(&format!("\ + .with_stdout("\ [RUNNING] target[..]release[..]foo-[..] running 1 test @@ -784,7 +784,7 @@ test foo ... bench: [..] 0 ns/iter (+/- 0) test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured -"))); +")); }); test!(bench_with_examples { @@ -893,7 +893,7 @@ test!(test_a_bench { assert_that(p.cargo_process("test"), execs().with_status(0) - .with_stdout(&format!("\ + .with_stdout("\ [COMPILING] foo v0.1.0 ([..]) [RUNNING] target[..]debug[..]b-[..] @@ -902,7 +902,7 @@ test foo ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); test!(test_bench_no_run { @@ -929,9 +929,9 @@ 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 { @@ -1001,20 +1001,20 @@ 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 -"))); +")); }); diff --git a/tests/test_cargo_build_lib.rs b/tests/test_cargo_build_lib.rs index c6d111835..5bd2373c7 100644 --- a/tests/test_cargo_build_lib.rs +++ b/tests/test_cargo_build_lib.rs @@ -48,7 +48,7 @@ test!(build_with_no_lib { 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 { diff --git a/tests/test_cargo_cfg.rs b/tests/test_cargo_cfg.rs index 7ce0e02b1..490a4c564 100644 --- a/tests/test_cargo_cfg.rs +++ b/tests/test_cargo_cfg.rs @@ -184,9 +184,9 @@ test!(dont_include { "#) .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 { @@ -211,14 +211,14 @@ 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 { @@ -235,7 +235,7 @@ 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: @@ -243,7 +243,7 @@ Caused by: Caused by: unexpected character in cfg `4`, [..] -"))); +")); }); test!(bad_target_spec2 { @@ -260,7 +260,7 @@ 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: @@ -268,7 +268,7 @@ Caused by: Caused by: expected a string, found nothing -"))); +")); }); test!(multiple_match_ok { diff --git a/tests/test_cargo_clean.rs b/tests/test_cargo_clean.rs index ff4f83865..aeededd68 100644 --- a/tests/test_cargo_clean.rs +++ b/tests/test_cargo_clean.rs @@ -127,9 +127,9 @@ test!(clean_release { 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 { @@ -163,12 +163,12 @@ 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 { diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 8e6d902da..d30eb82d5 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -43,12 +43,12 @@ test!(cargo_compile_with_invalid_manifest { 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 { @@ -61,14 +61,14 @@ 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 { @@ -85,12 +85,12 @@ 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 { @@ -105,12 +105,12 @@ 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` -"))) +")) }); @@ -126,12 +126,12 @@ test!(cargo_compile_with_invalid_package_name { 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 { @@ -149,12 +149,12 @@ 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 { @@ -172,12 +172,12 @@ 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 { @@ -195,12 +195,12 @@ 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 { @@ -209,9 +209,9 @@ 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 { @@ -227,10 +227,10 @@ src[..]foo.rs:1:1: 1:8 error: expected item[..]found `invalid` 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()); }); @@ -630,24 +630,24 @@ test!(cargo_compile_with_filename{ "#); 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 { @@ -680,13 +680,13 @@ 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 { @@ -805,7 +805,7 @@ test!(crate_authors_env_vars { 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"), @@ -935,9 +935,9 @@ test!(self_dependency { .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 { @@ -968,12 +968,12 @@ test!(missing_lib_and_bin { "#); 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 { @@ -1546,7 +1546,7 @@ test!(bad_cargo_config { 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: @@ -1556,7 +1556,7 @@ Caused by: could not parse input as TOML [..].cargo[..]config:2:20-2:21 expected `=`, but found `i` -"))); +")); }); test!(cargo_platform_specific_dependency { @@ -1769,7 +1769,7 @@ test!(transitive_dependencies_not_available { 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; [..] [..] @@ -1778,7 +1778,7 @@ error: aborting due to previous error Caused by: [..] -"))); +")); }); test!(cyclic_deps_rejected { @@ -1806,9 +1806,9 @@ 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 { @@ -1882,12 +1882,12 @@ test!(rustc_env_var { 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())); }); diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index 125e0a341..59889c954 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -203,10 +203,10 @@ test!(links_no_build_cmd { 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 { @@ -237,13 +237,13 @@ 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 { @@ -289,14 +289,14 @@ 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 { @@ -386,11 +386,11 @@ test!(only_rerun_build_script { 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 { @@ -470,7 +470,7 @@ test!(testing_and_such { 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 [..]` @@ -488,25 +488,25 @@ running 0 tests 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 { @@ -555,11 +555,11 @@ 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 { @@ -608,11 +608,11 @@ 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 { @@ -641,14 +641,14 @@ 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 { @@ -678,7 +678,7 @@ 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; [..] ^~~~~~~~~~~~~~~~~~~ @@ -687,7 +687,7 @@ error: aborting due to previous error Caused by: Process didn't exit successfully: [..] -"))); +")); }); test!(build_cmd_with_a_build_cmd { @@ -729,7 +729,7 @@ test!(build_cmd_with_a_build_cmd { assert_that(p.cargo_process("build").arg("-v"), 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://[..]) @@ -749,7 +749,7 @@ test!(build_cmd_with_a_build_cmd { [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 { @@ -818,12 +818,12 @@ test!(output_separate_lines { "#); 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 { @@ -844,12 +844,12 @@ 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) @@ -887,11 +887,11 @@ test!(code_generation { "#); 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)); @@ -927,12 +927,12 @@ test!(build_script_only { .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 { @@ -1536,7 +1536,7 @@ test!(flags_go_into_tests { "#); 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[..]` @@ -1552,10 +1552,10 @@ running 0 tests 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[..]` @@ -1565,7 +1565,7 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); test!(diamond_passes_args_only_once { @@ -1616,7 +1616,7 @@ 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] `[..]` @@ -1627,7 +1627,7 @@ test!(diamond_passes_args_only_once { [RUNNING] `rustc [..]` [COMPILING] foo v0.5.0 ([..] [RUNNING] `[..]rlib -L native=test` -"))); +")); }); test!(adding_an_override_invalidates { @@ -1650,12 +1650,12 @@ 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] @@ -1663,10 +1663,10 @@ test!(adding_an_override_invalidates { ", 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 { @@ -1688,10 +1688,10 @@ 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] @@ -1699,10 +1699,10 @@ test!(changing_an_override_invalidates { ", 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 { @@ -1729,11 +1729,11 @@ 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(); @@ -1742,17 +1742,17 @@ test!(rebuild_only_on_explicit_paths { // 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); @@ -1760,29 +1760,29 @@ test!(rebuild_only_on_explicit_paths { 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 [..]` -"))); +")); }); @@ -1814,9 +1814,9 @@ test!(doctest_recieves_build_link_args { 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 { @@ -1854,9 +1854,9 @@ 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 { diff --git a/tests/test_cargo_compile_git_deps.rs b/tests/test_cargo_compile_git_deps.rs index a140a982d..28e7ffd75 100644 --- a/tests/test_cargo_compile_git_deps.rs +++ b/tests/test_cargo_compile_git_deps.rs @@ -644,11 +644,11 @@ test!(update_with_shared_deps { 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. @@ -901,11 +901,11 @@ test!(dep_with_changed_submodule { 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)); @@ -943,11 +943,11 @@ test!(dep_with_changed_submodule { 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)); }); @@ -998,7 +998,7 @@ test!(dev_deps_with_testing { // 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-[..] @@ -1008,7 +1008,7 @@ test tests::foo ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); test!(git_build_cmd_freshness { @@ -1328,14 +1328,14 @@ test!(update_ambiguous { 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 ` where `` is one of the \ following: foo:0.[..].0 foo:0.[..].0 -"))); +")); }); test!(update_one_dep_in_repo_with_many_deps { @@ -1553,12 +1553,12 @@ test!(switch_sources { 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] @@ -1571,12 +1571,12 @@ test!(switch_sources { 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 { @@ -1677,11 +1677,11 @@ test!(lints_are_suppressed { .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 { @@ -1714,11 +1714,11 @@ 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 { diff --git a/tests/test_cargo_compile_path_deps.rs b/tests/test_cargo_compile_path_deps.rs index 3d050403d..4ac9e2a15 100644 --- a/tests/test_cargo_compile_path_deps.rs +++ b/tests/test_cargo_compile_path_deps.rs @@ -174,7 +174,7 @@ test!(cargo_compile_with_root_dev_deps_with_testing { 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-[..] @@ -183,7 +183,7 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); test!(cargo_compile_with_transitive_dev_deps { @@ -509,7 +509,7 @@ test!(error_message_for_missing_manifest { assert_that(p.cargo_process("build"), execs().with_status(101) - .with_stderr(&format!("\ + .with_stderr("\ [ERROR] Unable to update file://[..] Caused by: @@ -517,7 +517,7 @@ Caused by: Caused by: [..] (os error [..]) -"))); +")); }); @@ -783,18 +783,18 @@ test!(custom_target_no_rebuild { 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 { @@ -831,11 +831,11 @@ 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 { @@ -853,7 +853,7 @@ 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 `[..]`) @@ -862,5 +862,5 @@ Caused by: Caused by: [..] (os error [..]) -"))); +")); }); diff --git a/tests/test_cargo_compile_plugins.rs b/tests/test_cargo_compile_plugins.rs index 94dcdd171..3d4541fa4 100644 --- a/tests/test_cargo_compile_plugins.rs +++ b/tests/test_cargo_compile_plugins.rs @@ -262,8 +262,8 @@ test!(native_plugin_dependency_with_custom_ar_linker { 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 [..]` -"))); +")); }); diff --git a/tests/test_cargo_concurrent.rs b/tests/test_cargo_concurrent.rs index abb5b4d46..eb778f41c 100644 --- a/tests/test_cargo_concurrent.rs +++ b/tests/test_cargo_concurrent.rs @@ -117,9 +117,9 @@ test!(one_install_should_be_bad { 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 [..] ")); @@ -409,10 +409,10 @@ test!(debug_release_ok { 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 [..] -"))); +")); }); diff --git a/tests/test_cargo_cross_compile.rs b/tests/test_cargo_cross_compile.rs index 51e406a5a..643431ef8 100644 --- a/tests/test_cargo_cross_compile.rs +++ b/tests/test_cargo_cross_compile.rs @@ -671,8 +671,8 @@ test!(build_script_needed_for_host_and_target { .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!("\ @@ -789,12 +789,12 @@ test!(plugin_build_script_right_arch { 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 { @@ -888,7 +888,7 @@ test!(platform_specific_dependencies_do_not_leak { 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; [..] @@ -897,7 +897,7 @@ error: aborting due to previous error Caused by: [..] -"))); +")); }); test!(platform_specific_variables_reflected_in_build_scripts { diff --git a/tests/test_cargo_doc.rs b/tests/test_cargo_doc.rs index da19600c7..dc1b32b60 100644 --- a/tests/test_cargo_doc.rs +++ b/tests/test_cargo_doc.rs @@ -202,10 +202,10 @@ test!(doc_lib_bin_same_name { 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 { @@ -240,11 +240,11 @@ 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 { @@ -426,10 +426,10 @@ test!(doc_release { 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 { diff --git a/tests/test_cargo_features.rs b/tests/test_cargo_features.rs index e29d2fc69..b3c73db7a 100644 --- a/tests/test_cargo_features.rs +++ b/tests/test_cargo_features.rs @@ -22,12 +22,12 @@ test!(invalid1 { .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 { @@ -47,12 +47,12 @@ 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 { @@ -72,13 +72,13 @@ 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 { @@ -103,9 +103,9 @@ 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] @@ -115,9 +115,9 @@ test!(invalid4 { "#); 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 { @@ -135,12 +135,12 @@ 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 { @@ -157,12 +157,12 @@ 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 { @@ -180,12 +180,12 @@ 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 { @@ -210,9 +210,9 @@ 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 { @@ -320,9 +320,9 @@ test!(cyclic_feature { .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 { @@ -340,9 +340,9 @@ 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 { @@ -538,10 +538,10 @@ test!(many_features_no_rebuilds { 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 ""` @@ -764,9 +764,9 @@ test!(optional_and_dev_dep { .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 { diff --git a/tests/test_cargo_freshness.rs b/tests/test_cargo_freshness.rs index fa4fcd89e..627225479 100644 --- a/tests/test_cargo_freshness.rs +++ b/tests/test_cargo_freshness.rs @@ -249,11 +249,11 @@ test!(no_rebuild_transitive_target_deps { 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 { diff --git a/tests/test_cargo_init.rs b/tests/test_cargo_init.rs index 7a896fe6b..d2075e3a7 100644 --- a/tests/test_cargo_init.rs +++ b/tests/test_cargo_init.rs @@ -125,9 +125,9 @@ test!(confused_by_multiple_lib_files { 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())); }); @@ -155,12 +155,12 @@ test!(multibin_project_name_clash { 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())); }); @@ -228,10 +228,10 @@ test!(invalid_dir_name { 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())); }); @@ -241,10 +241,10 @@ test!(reserved_name { 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())); }); @@ -370,13 +370,13 @@ test!(with_argument { 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] [] cargo init -h | --help -"))); +")); }); #[cfg(not(windows))] diff --git a/tests/test_cargo_install.rs b/tests/test_cargo_install.rs index 5ceeab243..85c0515ba 100644 --- a/tests/test_cargo_install.rs +++ b/tests/test_cargo_install.rs @@ -95,22 +95,22 @@ test!(pick_max_version { 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: @@ -118,7 +118,7 @@ Caused by: Caused by: [..] (os error [..]) -"))); +")); }); test!(install_location_precedence { @@ -184,10 +184,10 @@ test!(install_path { 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 { @@ -209,9 +209,9 @@ 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 { @@ -324,9 +324,9 @@ test!(no_binaries_or_examples { 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 { @@ -342,9 +342,9 @@ 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 { @@ -380,11 +380,11 @@ test!(install_twice { 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 { @@ -527,7 +527,7 @@ test!(compile_failure { 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 \ @@ -537,7 +537,7 @@ Caused by: Could not compile `foo`. To learn more, run the command again with --verbose. -"))); +")); }); test!(git_repo { @@ -585,9 +585,9 @@ foo v0.0.1 (registry [..]): 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 { @@ -596,9 +596,9 @@ 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 { @@ -633,9 +633,9 @@ 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 { diff --git a/tests/test_cargo_metadata.rs b/tests/test_cargo_metadata.rs index ec030ced9..4a370e598 100644 --- a/tests/test_cargo_metadata.rs +++ b/tests/test_cargo_metadata.rs @@ -177,11 +177,11 @@ test!(cargo_metadata_with_invalid_manifest { .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= @@ -238,8 +238,8 @@ test!(cargo_metadata_no_deps_path_to_cargo_toml_parent_relative { .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 { @@ -251,8 +251,8 @@ 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 { diff --git a/tests/test_cargo_new.rs b/tests/test_cargo_new.rs index 3020c5dbd..4a73925c2 100644 --- a/tests/test_cargo_new.rs +++ b/tests/test_cargo_new.rs @@ -67,13 +67,13 @@ test!(simple_git { test!(no_argument { assert_that(cargo_process("new"), execs().with_status(1) - .with_stderr(&format!("\ + .with_stderr("\ [ERROR] Invalid arguments. Usage: cargo new [options] cargo new -h | --help -"))); +")); }); test!(existing { @@ -88,17 +88,17 @@ 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 { @@ -281,11 +281,11 @@ test!(subpackage_git_with_vcs_arg { 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 [..] -"))); +")); }); diff --git a/tests/test_cargo_overrides.rs b/tests/test_cargo_overrides.rs index b73ea6d5e..216c39643 100644 --- a/tests/test_cargo_overrides.rs +++ b/tests/test_cargo_overrides.rs @@ -41,12 +41,12 @@ test!(override_simple { "); 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 { @@ -135,14 +135,14 @@ test!(transitive { .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("")); }); @@ -181,12 +181,12 @@ test!(persists_across_rebuilds { "); 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("")); @@ -226,11 +226,11 @@ test!(replace_registry_with_path { "); 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 { @@ -281,7 +281,7 @@ 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] [..] @@ -290,7 +290,7 @@ test!(use_a_spec_to_select { [COMPILING] [..] [COMPILING] [..] [COMPILING] local v0.0.1 (file://[..]) -"))); +")); }); test!(override_adds_some_deps { @@ -326,26 +326,26 @@ 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("")); }); diff --git a/tests/test_cargo_package.rs b/tests/test_cargo_package.rs index 423a717bf..6cd97c1ef 100644 --- a/tests/test_cargo_package.rs +++ b/tests/test_cargo_package.rs @@ -327,10 +327,10 @@ test!(no_duplicates_from_modified_tracked_files { 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 { @@ -399,11 +399,11 @@ test!(package_weird_characters { .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 -"))); +")); }); diff --git a/tests/test_cargo_publish.rs b/tests/test_cargo_publish.rs index ae164feb3..3d5e65de0 100644 --- a/tests/test_cargo_publish.rs +++ b/tests/test_cargo_publish.rs @@ -99,10 +99,10 @@ test!(git_deps { .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 { @@ -128,10 +128,10 @@ 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 { @@ -148,8 +148,8 @@ 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 -"))); +")); }); diff --git a/tests/test_cargo_read_manifest.rs b/tests/test_cargo_read_manifest.rs index 476bc5819..f5e72ab3a 100644 --- a/tests/test_cargo_read_manifest.rs +++ b/tests/test_cargo_read_manifest.rs @@ -58,8 +58,8 @@ test!(cargo_read_manifest_path_to_cargo_toml_parent_relative { .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 { @@ -71,8 +71,8 @@ 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 { diff --git a/tests/test_cargo_registry.rs b/tests/test_cargo_registry.rs index 3dbc51ca0..e438b5d27 100644 --- a/tests/test_cargo_registry.rs +++ b/tests/test_cargo_registry.rs @@ -92,11 +92,11 @@ test!(nonexistent { .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 { @@ -116,23 +116,23 @@ 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 { @@ -153,7 +153,7 @@ 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: @@ -161,7 +161,7 @@ Caused by: Caused by: failed to verify the checksum of `bad-cksum v0.0.1 (registry file://[..])` -"))); +")); }); test!(update_registry { @@ -180,11 +180,11 @@ 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(); @@ -227,14 +227,14 @@ test!(package_with_path_deps { 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(); @@ -367,12 +367,12 @@ test!(relying_on_a_yank_is_bad { 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 { @@ -402,11 +402,11 @@ 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 { @@ -430,10 +430,10 @@ 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 { @@ -461,10 +461,10 @@ 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"), @@ -478,10 +478,10 @@ test!(update_lockfile { 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"), @@ -565,8 +565,8 @@ test!(bad_license_file { "#); 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 { @@ -735,10 +735,10 @@ test!(fetch_downloads { 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 { @@ -765,19 +765,19 @@ 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 { @@ -811,9 +811,9 @@ 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 { @@ -845,35 +845,35 @@ 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 { @@ -982,12 +982,12 @@ test!(only_download_relevant { 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 { diff --git a/tests/test_cargo_run.rs b/tests/test_cargo_run.rs index 1376b0ab2..7a602513d 100644 --- a/tests/test_cargo_run.rs +++ b/tests/test_cargo_run.rs @@ -61,9 +61,9 @@ test!(simple_quiet_and_verbose { "#); 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 { @@ -119,9 +119,9 @@ test!(exit_code { 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 { @@ -138,9 +138,9 @@ 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 { @@ -155,8 +155,8 @@ 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 { @@ -173,9 +173,9 @@ 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 { @@ -261,24 +261,24 @@ test!(run_with_filename { "#); 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 { @@ -298,9 +298,9 @@ 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 { diff --git a/tests/test_cargo_rustc.rs b/tests/test_cargo_rustc.rs index 2e26b1115..942c99aa3 100644 --- a/tests/test_cargo_rustc.rs +++ b/tests/test_cargo_rustc.rs @@ -7,11 +7,9 @@ use hamcrest::assert_that; 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") @@ -122,7 +120,7 @@ test!(fails_when_trying_to_build_main_and_lib_with_args { .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 { @@ -181,7 +179,7 @@ test!(fails_with_args_to_all_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 { @@ -285,10 +283,10 @@ test!(build_only_bar_dependency { .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 { @@ -340,11 +338,11 @@ 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] [--] [...]"))); + cargo rustc [options] [--] [...]")); }); test!(rustc_with_other_profile { diff --git a/tests/test_cargo_rustdoc.rs b/tests/test_cargo_rustdoc.rs index 60659e352..b8a965aa7 100644 --- a/tests/test_cargo_rustdoc.rs +++ b/tests/test_cargo_rustdoc.rs @@ -161,7 +161,7 @@ test!(rustdoc_same_name_err { .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`")); }); diff --git a/tests/test_cargo_search.rs b/tests/test_cargo_search.rs index c40c37958..d557e2828 100644 --- a/tests/test_cargo_search.rs +++ b/tests/test_cargo_search.rs @@ -80,9 +80,9 @@ test!(simple { } 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 { @@ -126,9 +126,9 @@ 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 { diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index ab64d7acc..22b824149 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -480,7 +480,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured assert_that(p.cargo("test").arg("foo"), execs().with_status(0) - .with_stdout(&format!("\ + .with_stdout("\ [RUNNING] target[..]foo-[..] running 1 test @@ -494,7 +494,7 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); // Regression test for running cargo-test twice with @@ -726,11 +726,11 @@ test!(bin_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: - binary target bin.name is required"))); + binary target bin.name is required")); }); test!(bench_without_name { @@ -770,11 +770,11 @@ 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 { @@ -813,11 +813,11 @@ 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 { @@ -856,11 +856,11 @@ 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 { @@ -957,7 +957,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured 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 @@ -972,7 +972,7 @@ test foo ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); @@ -1013,7 +1013,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured assert_that(p.cargo("test"), execs().with_status(0) - .with_stdout(format!("\ + .with_stdout("\ [RUNNING] target[..]foo-[..] running 1 test @@ -1027,7 +1027,7 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); test!(test_then_build { @@ -1471,11 +1471,11 @@ test!(example_bin_same_name { 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()); }); @@ -1528,13 +1528,13 @@ test!(example_with_dev_dep { 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 { @@ -1569,13 +1569,13 @@ test!(bad_example { .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 { @@ -1597,7 +1597,7 @@ 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[..] @@ -1612,7 +1612,7 @@ test foo_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -"))) +")) }); test!(dashes_to_underscores { @@ -1680,7 +1680,7 @@ test!(filter_no_doc_tests { .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[..] @@ -1688,7 +1688,7 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); test!(dylib_doctest { @@ -1712,7 +1712,7 @@ test!(dylib_doctest { "#); assert_that(p.cargo_process("test"), - execs().with_stdout(format!("\ + execs().with_stdout("\ [COMPILING] foo v0.0.1 ([..]) [DOCTEST] foo @@ -1721,7 +1721,7 @@ test foo_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -"))); +")); }); test!(dylib_doctest2 { @@ -1778,7 +1778,7 @@ test!(cyclic_dev_dep_doc_test { 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[..] @@ -1794,7 +1794,7 @@ test _0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -"))) +")) }); test!(dev_dep_with_build_script { @@ -1869,7 +1869,7 @@ test!(no_fail_fast { "#); 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[..] @@ -1878,8 +1878,8 @@ running 0 tests 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[..] @@ -1896,7 +1896,7 @@ test sub_one_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -"))) +")) }); test!(test_multiple_packages { @@ -1943,20 +1943,20 @@ test!(test_multiple_packages { assert_that(p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"), 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 { @@ -1981,11 +1981,11 @@ 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 { @@ -2040,11 +2040,11 @@ test!(selective_test_optional_dep { 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 {