From: Aleksey Kladov Date: Wed, 14 Mar 2018 15:43:41 +0000 (+0300) Subject: Prettify rustfmted single-line strings X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~41^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b0c181d91ccfe1d27d4c7133049a6bfe5bacf29b;p=cargo.git Prettify rustfmted single-line strings --- diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs index e9cf6ce00..089dac9ce 100644 --- a/tests/testsuite/alt_registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -410,39 +410,17 @@ fn alt_registry_and_crates_io_deps() { execs() .with_status(0) .with_stderr_contains(format!( - "\ - [UPDATING] registry `{}`", + "[UPDATING] registry `{}`", registry::alt_registry() )) - .with_stderr_contains(&format!( - "\ - [UPDATING] registry `{}`", - registry::registry() - )) - .with_stderr_contains( - "\ - [DOWNLOADING] crates_io_dep v0.0.1 (registry `file://[..]`)", - ) - .with_stderr_contains( - "\ - [DOWNLOADING] alt_reg_dep v0.1.0 (registry `file://[..]`)", - ) - .with_stderr_contains( - "\ - [COMPILING] alt_reg_dep v0.1.0 (registry `file://[..]`)", - ) - .with_stderr_contains( - "\ - [COMPILING] crates_io_dep v0.0.1", - ) - .with_stderr_contains(&format!( - "\ - [COMPILING] foo v0.0.1 ({})", - p.url() - )) + .with_stderr_contains(&format!("[UPDATING] registry `{}`", registry::registry())) + .with_stderr_contains("[DOWNLOADING] crates_io_dep v0.0.1 (registry `file://[..]`)") + .with_stderr_contains("[DOWNLOADING] alt_reg_dep v0.1.0 (registry `file://[..]`)") + .with_stderr_contains("[COMPILING] alt_reg_dep v0.1.0 (registry `file://[..]`)") + .with_stderr_contains("[COMPILING] crates_io_dep v0.0.1") + .with_stderr_contains(&format!("[COMPILING] foo v0.0.1 ({})", p.url())) .with_stderr_contains( - "\ - [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs", + "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs", ), ) } diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index addfc5edc..0486297f3 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -207,11 +207,9 @@ fn bad_cargo_config_jobs() { .build(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(101).with_stderr( - "\ -[ERROR] build.jobs must be positive, but found -1 in [..] -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] build.jobs must be positive, but found -1 in [..]"), ); } @@ -531,9 +529,7 @@ fn bad_crate_type() { assert_that( p.cargo("build").arg("-v"), execs().with_status(101).with_stderr_contains( - "\ -error: failed to run `rustc` to learn about target-specific information -", + "error: failed to run `rustc` to learn about target-specific information", ), ); } @@ -1032,11 +1028,9 @@ fn bad_source_config1() { assert_that( p.cargo("build"), - execs().with_status(101).with_stderr( - "\ -error: no source URL specified for `source.foo`, need [..] -", - ), + execs() + .with_status(101) + .with_stderr("error: no source URL specified for `source.foo`, need [..]"), ); } @@ -1274,9 +1268,7 @@ fn bad_source_config6() { assert_that( p.cargo("build"), execs().with_status(101).with_stderr( - "\ -error: expected a string, but found a array for `source.crates-io.replace-with` in [..] -", + "error: expected a string, but found a array for `source.crates-io.replace-with` in [..]", ), ); } @@ -1340,11 +1332,9 @@ fn bad_source_config7() { assert_that( p.cargo("build"), - execs().with_status(101).with_stderr( - "\ -error: more than one source URL specified for `source.foo` -", - ), + execs() + .with_status(101) + .with_stderr("error: more than one source URL specified for `source.foo`"), ); } diff --git a/tests/testsuite/bad_manifest_path.rs b/tests/testsuite/bad_manifest_path.rs index 788c4cde4..c3fb92f06 100644 --- a/tests/testsuite/bad_manifest_path.rs +++ b/tests/testsuite/bad_manifest_path.rs @@ -331,8 +331,7 @@ fn verify_project_dir_containing_cargo_toml() { .arg("foo") .cwd(p.root().parent().unwrap()), execs().with_status(1).with_stdout( - "\ - {\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\ + "{\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\ ", ), ); @@ -351,8 +350,7 @@ fn verify_project_dir_plus_file() { .arg("foo/bar") .cwd(p.root().parent().unwrap()), execs().with_status(1).with_stdout( - "\ - {\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\ + "{\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\ ", ), ); @@ -371,8 +369,7 @@ fn verify_project_dir_plus_path() { .arg("foo/bar/baz") .cwd(p.root().parent().unwrap()), execs().with_status(1).with_stdout( - "\ - {\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\ + "{\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\ ", ), ); @@ -387,8 +384,7 @@ fn verify_project_dir_to_nonexistent_cargo_toml() { .arg("foo/bar/baz/Cargo.toml") .cwd(p.root().parent().unwrap()), execs().with_status(1).with_stdout( - "\ - {\"invalid\":\"manifest path `foo[..]bar[..]baz[..]Cargo.toml` does not exist\"}\ + "{\"invalid\":\"manifest path `foo[..]bar[..]baz[..]Cargo.toml` does not exist\"}\ ", ), ); diff --git a/tests/testsuite/bench.rs b/tests/testsuite/bench.rs index 30499420b..ce05e1dfe 100644 --- a/tests/testsuite/bench.rs +++ b/tests/testsuite/bench.rs @@ -1379,15 +1379,9 @@ fn test_bench_no_fail_fast() { .arg("--test-threads=1"), execs() .with_status(101) - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]") .with_stdout_contains("running 2 tests") - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]") .with_stdout_contains("test bench_hello [..]") .with_stdout_contains("test bench_nope [..]"), ); @@ -1480,15 +1474,9 @@ fn test_bench_multiple_packages() { p.cargo("bench").arg("-p").arg("bar").arg("-p").arg("baz"), execs() .with_status(0) - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]bbaz-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bbaz-[..][EXE]") .with_stdout_contains("test bench_baz ... bench: [..]") - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]bbar-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bbar-[..][EXE]") .with_stdout_contains("test bench_bar ... bench: [..]"), ); } @@ -1563,15 +1551,9 @@ fn bench_all_workspace() { p.cargo("bench").arg("--all"), execs() .with_status(0) - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]bar-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bar-[..][EXE]") .with_stdout_contains("test bench_bar ... bench: [..]") - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]") .with_stdout_contains("test bench_foo ... bench: [..]"), ); } @@ -1723,15 +1705,9 @@ fn bench_all_virtual_manifest() { p.cargo("bench").arg("--all"), execs() .with_status(0) - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]bar-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bar-[..][EXE]") .with_stdout_contains("test bench_bar ... bench: [..]") - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]") .with_stdout_contains("test bench_foo ... bench: [..]"), ); } @@ -1855,15 +1831,9 @@ fn bench_virtual_manifest_all_implied() { p.cargo("bench"), execs() .with_status(0) - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]bar-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bar-[..][EXE]") .with_stdout_contains("test bench_bar ... bench: [..]") - .with_stderr_contains( - "\ - [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]") .with_stdout_contains("test bench_foo ... bench: [..]"), ); } diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 9e28554da..7cf2e0116 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -486,11 +486,9 @@ fn cargo_compile_without_manifest() { assert_that( p.cargo("build"), - execs().with_status(101).with_stderr( - "\ -[ERROR] could not find `Cargo.toml` in `[..]` or any parent directory -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] could not find `Cargo.toml` in `[..]` or any parent directory"), ); } @@ -552,11 +550,9 @@ fn cargo_compile_with_warnings_in_the_root_package() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr_contains( - "\ -[..]function is never used: `dead`[..] -", - ), + execs() + .with_status(0) + .with_stderr_contains("[..]function is never used: `dead`[..]"), ); } @@ -609,11 +605,9 @@ fn cargo_compile_with_warnings_in_a_dep_package() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr_contains( - "\ -[..]function is never used: `dead`[..] -", - ), + execs() + .with_status(0) + .with_stderr_contains("[..]function is never used: `dead`[..]"), ); assert_that(&p.bin("foo"), existing_file()); @@ -1010,10 +1004,9 @@ fn cargo_compile_with_filename() { assert_that( p.cargo("build").arg("--bin").arg("bin.rs"), - execs().with_status(101).with_stderr( - "\ - [ERROR] no bin target named `bin.rs`", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] no bin target named `bin.rs`"), ); assert_that( @@ -1028,10 +1021,9 @@ Did you mean `a`?", assert_that( p.cargo("build").arg("--example").arg("example.rs"), - execs().with_status(101).with_stderr( - "\ - [ERROR] no example target named `example.rs`", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] no example target named `example.rs`"), ); assert_that( @@ -3283,11 +3275,9 @@ fn transitive_dependencies_not_available() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(101).with_stderr_contains( - "\ -[..] can't find crate for `bbbbb`[..] -", - ), + execs() + .with_status(101) + .with_stderr_contains("[..] can't find crate for `bbbbb`[..]"), ); } @@ -3783,11 +3773,9 @@ fn invalid_spec() { assert_that( p.cargo("build").arg("-p").arg("notAValidDep"), - execs().with_status(101).with_stderr( - "\ -[ERROR] package id specification `notAValidDep` matched no packages -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] package id specification `notAValidDep` matched no packages"), ); assert_that( @@ -3796,11 +3784,9 @@ fn invalid_spec() { .arg("d1") .arg("-p") .arg("notAValidDep"), - execs().with_status(101).with_stderr( - "\ -[ERROR] package id specification `notAValidDep` matched no packages -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] package id specification `notAValidDep` matched no packages"), ); } @@ -5032,9 +5018,7 @@ fn inferred_bins_duplicate_name() { assert_that( p.cargo("build"), execs().with_status(101).with_stderr_contains( - "\ -[..]found duplicate binary name foo, but all binary targets must have a unique name[..] -", + "[..]found duplicate binary name foo, but all binary targets must have a unique name[..]", ), ); } @@ -5320,8 +5304,7 @@ fn build_filter_infer_profile() { --emit=dep-info,link[..]", ) .with_stderr_contains( - "\ - [RUNNING] `rustc --crate-name t1 tests[/]t1.rs --emit=dep-info,link[..]", + "[RUNNING] `rustc --crate-name t1 tests[/]t1.rs --emit=dep-info,link[..]", ) .with_stderr_contains( "\ @@ -5463,10 +5446,8 @@ fn invalid_jobs() { assert_that( p.cargo("build").arg("--jobs").arg("over9000"), - execs().with_status(1).with_stderr( - "\ -error: Invalid value: could not parse `over9000` as a number -", - ), + execs() + .with_status(1) + .with_stderr("error: Invalid value: could not parse `over9000` as a number"), ); } diff --git a/tests/testsuite/build_auth.rs b/tests/testsuite/build_auth.rs index 40caa7903..01df88036 100644 --- a/tests/testsuite/build_auth.rs +++ b/tests/testsuite/build_auth.rs @@ -198,9 +198,7 @@ fn https_something_happens() { execs() .with_status(101) .with_stderr_contains(&format!( - "\ -[UPDATING] git repository `https://{addr}/foo/bar` -", + "[UPDATING] git repository `https://{addr}/foo/bar`", addr = addr )) .with_stderr_contains(&format!( @@ -257,9 +255,7 @@ fn ssh_something_happens() { execs() .with_status(101) .with_stderr_contains(&format!( - "\ -[UPDATING] git repository `ssh://{addr}/foo/bar` -", + "[UPDATING] git repository `ssh://{addr}/foo/bar`", addr = addr )) .with_stderr_contains( diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 97a363bf2..59aee0632 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -985,11 +985,7 @@ fn build_deps_not_for_normal() { p.cargo("build").arg("-v").arg("--target").arg(&target), execs() .with_status(101) - .with_stderr_contains( - "\ -[..]can't find crate for `aaaaa`[..] -", - ) + .with_stderr_contains("[..]can't find crate for `aaaaa`[..]") .with_stderr_contains( "\ [ERROR] Could not compile `foo`. @@ -1276,11 +1272,7 @@ fn code_generation() { [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] `target[/]debug[/]foo`", ) - .with_stdout( - "\ -Hello, World! -", - ), + .with_stdout("Hello, World!"), ); assert_that(p.cargo("test"), execs().with_status(0)); @@ -2806,9 +2798,7 @@ fn doctest_recieves_build_link_args() { assert_that( p.cargo("test").arg("-v"), execs().with_status(0).with_stderr_contains( - "\ -[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]` -", + "[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`", ), ); } @@ -2862,11 +2852,9 @@ fn please_respect_the_dag() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr_contains( - "\ -[RUNNING] `rustc [..] -L native=foo -L native=bar[..]` -", - ), + execs() + .with_status(0) + .with_stderr_contains("[RUNNING] `rustc [..] -L native=foo -L native=bar[..]`"), ); } @@ -3201,15 +3189,8 @@ fn output_shows_on_vv() { assert_that( p.cargo("build").arg("-vv"), - execs() - .with_status(0) - .with_stdout( - "\ -stdout -", - ) - .with_stderr( - "\ + execs().with_status(0).with_stdout("stdout").with_stderr( + "\ [COMPILING] foo v0.5.0 ([..]) [RUNNING] `rustc [..]` [RUNNING] `[..]` @@ -3217,7 +3198,7 @@ stderr [RUNNING] `rustc [..]` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", - ), + ), ); } @@ -3260,11 +3241,9 @@ fn links_with_dots() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr_contains( - "\ -[RUNNING] `rustc --crate-name foo [..] [..] -L foo[..]` -", - ), + execs() + .with_status(0) + .with_stderr_contains("[RUNNING] `rustc --crate-name foo [..] [..] -L foo[..]`"), ); } diff --git a/tests/testsuite/build_script_env.rs b/tests/testsuite/build_script_env.rs index 494f1948c..382ef2585 100644 --- a/tests/testsuite/build_script_env.rs +++ b/tests/testsuite/build_script_env.rs @@ -61,11 +61,7 @@ fn rerun_if_env_changes() { ); assert_that( p.cargo("build").env("FOO", "baz"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] [..] -", - ), + execs().with_status(0).with_stderr("[FINISHED] [..]"), ); assert_that( p.cargo("build"), @@ -128,11 +124,7 @@ fn rerun_if_env_or_file_changes() { ); assert_that( p.cargo("build").env("FOO", "bar"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] [..] -", - ), + execs().with_status(0).with_stderr("[FINISHED] [..]"), ); sleep_ms(1000); File::create(p.root().join("foo")).unwrap(); diff --git a/tests/testsuite/cargo_command.rs b/tests/testsuite/cargo_command.rs index 3164e6c2a..d0574a6d8 100644 --- a/tests/testsuite/cargo_command.rs +++ b/tests/testsuite/cargo_command.rs @@ -256,8 +256,7 @@ fn explain() { assert_that( cargo_process().arg("--explain").arg("E0001"), execs().with_status(0).with_stdout_contains( - "\ - This error suggests that the expression arm corresponding to the noted pattern", + "This error suggests that the expression arm corresponding to the noted pattern", ), ); } diff --git a/tests/testsuite/cargo_features.rs b/tests/testsuite/cargo_features.rs index a4c9637ca..82de88676 100644 --- a/tests/testsuite/cargo_features.rs +++ b/tests/testsuite/cargo_features.rs @@ -274,20 +274,16 @@ fn z_flags_rejected() { .build(); assert_that( p.cargo("build").arg("-Zprint-im-a-teapot"), - execs().with_status(101).with_stderr( - "\ -error: the `-Z` flag is only accepted on the nightly channel of Cargo -", - ), + execs() + .with_status(101) + .with_stderr("error: the `-Z` flag is only accepted on the nightly channel of Cargo"), ); assert_that( p.cargo("build").masquerade_as_nightly_cargo().arg("-Zarg"), - execs().with_status(101).with_stderr( - "\ -error: unknown `-Z` flag specified: arg -", - ), + execs() + .with_status(101) + .with_stderr("error: unknown `-Z` flag specified: arg"), ); assert_that( @@ -325,9 +321,7 @@ fn publish_rejected() { assert_that( p.cargo("publish").masquerade_as_nightly_cargo(), execs().with_status(101).with_stderr( - "\ -error: cannot publish crates which activate nightly-only cargo features to crates.io -", + "error: cannot publish crates which activate nightly-only cargo features to crates.io", ), ); } diff --git a/tests/testsuite/check.rs b/tests/testsuite/check.rs index 1ff619b0e..7499f136d 100644 --- a/tests/testsuite/check.rs +++ b/tests/testsuite/check.rs @@ -399,11 +399,9 @@ fn dylib_check_preserves_build_cache() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); } diff --git a/tests/testsuite/concurrent.rs b/tests/testsuite/concurrent.rs index fb0a05247..9c777e2cc 100644 --- a/tests/testsuite/concurrent.rs +++ b/tests/testsuite/concurrent.rs @@ -145,18 +145,14 @@ fn one_install_should_be_bad() { assert_that( bad, execs().with_status(101).with_stderr_contains( - "\ -[ERROR] binary `foo[..]` already exists in destination as part of `[..]` -", + "[ERROR] binary `foo[..]` already exists in destination as part of `[..]`", ), ); assert_that( good, - execs().with_status(0).with_stderr_contains( - "\ -warning: be sure to add `[..]` to your PATH [..] -", - ), + execs() + .with_status(0) + .with_stderr_contains("warning: be sure to add `[..]` to your PATH [..]"), ); assert_that(cargo_home(), has_installed_exe("foo")); diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index 97e81e6dd..c17a6fd71 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -872,25 +872,20 @@ fn build_script_needed_for_host_and_target() { execs() .with_status(0) .with_stderr_contains(&format!( - "\ - [COMPILING] d1 v0.0.0 ({url}/d1)", + "[COMPILING] d1 v0.0.0 ({url}/d1)", url = p.url() )) - .with_stderr_contains(&format!("\ -[RUNNING] `rustc [..] d1[/]build.rs [..] --out-dir {dir}[/]target[/]debug[/]build[/]d1-[..]`", + .with_stderr_contains(&format!("[RUNNING] `rustc [..] d1[/]build.rs [..] --out-dir {dir}[/]target[/]debug[/]build[/]d1-[..]`", dir = p.root().display())) .with_stderr_contains(&format!( - "\ - [RUNNING] `{dir}[/]target[/]debug[/]build[/]d1-[..][/]build-script-build`", + "[RUNNING] `{dir}[/]target[/]debug[/]build[/]d1-[..][/]build-script-build`", dir = p.root().display() )) .with_stderr_contains( - "\ - [RUNNING] `rustc [..] d1[/]src[/]lib.rs [..]`", + "[RUNNING] `rustc [..] d1[/]src[/]lib.rs [..]`", ) .with_stderr_contains(&format!( - "\ - [COMPILING] d2 v0.0.0 ({url}/d2)", + "[COMPILING] d2 v0.0.0 ({url}/d2)", url = p.url() )) .with_stderr_contains(&format!( @@ -900,8 +895,7 @@ fn build_script_needed_for_host_and_target() { host = host )) .with_stderr_contains(&format!( - "\ - [COMPILING] foo v0.0.0 ({url})", + "[COMPILING] foo v0.0.0 ({url})", url = p.url() )) .with_stderr_contains(&format!("\ @@ -1217,10 +1211,9 @@ fn platform_specific_dependencies_do_not_leak() { assert_that( p.cargo("build").arg("-v").arg("--target").arg(&target), - execs().with_status(101).with_stderr_contains( - "\ - [..] can't find crate for `d2`[..]", - ), + execs() + .with_status(101) + .with_stderr_contains("[..] can't find crate for `d2`[..]"), ); } diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index 7fbf3fc32..f877d3ea5 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -161,10 +161,9 @@ failed to select a version for `bar` which could resolve this conflict", assert_that( p.cargo("build").arg("--features").arg("test"), - execs().with_status(101).with_stderr( - "\ - error: Package `foo v0.0.1 ([..])` does not have these features: `test`", - ), + execs() + .with_status(101) + .with_stderr("error: Package `foo v0.0.1 ([..])` does not have these features: `test`"), ); } @@ -294,11 +293,9 @@ fn invalid8() { assert_that( p.cargo("build").arg("--features").arg("foo"), - execs().with_status(101).with_stderr( - "\ -[ERROR] feature names may not contain slashes: `foo/bar` -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] feature names may not contain slashes: `foo/bar`"), ); } @@ -459,11 +456,9 @@ fn no_transitive_dep_feature_requirement() { .build(); assert_that( p.cargo("build"), - execs().with_status(101).with_stderr( - "\ -[ERROR] feature names may not contain slashes: `bar/qux` -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] feature names may not contain slashes: `bar/qux`"), ); } @@ -632,11 +627,9 @@ fn cyclic_feature() { assert_that( p.cargo("build"), - execs().with_status(101).with_stderr( - "\ -[ERROR] Cyclic feature dependency: feature `default` depends on itself -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] Cyclic feature dependency: feature `default` depends on itself"), ); } @@ -1399,10 +1392,9 @@ fn dep_feature_in_cmd_line() { // Trying to enable features of transitive dependencies is an error assert_that( p.cargo("build").arg("--features").arg("bar/some-feat"), - execs().with_status(101).with_stderr( - "\ - error: Package `foo v0.0.1 ([..])` does not have these features: `bar`", - ), + execs() + .with_status(101) + .with_stderr("error: Package `foo v0.0.1 ([..])` does not have these features: `bar`"), ); // Hierarchical feature specification should still be disallowed @@ -1410,11 +1402,9 @@ fn dep_feature_in_cmd_line() { p.cargo("build") .arg("--features") .arg("derived/bar/some-feat"), - execs().with_status(101).with_stderr( - "\ -[ERROR] feature names may not contain slashes: `bar/some-feat` -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] feature names may not contain slashes: `bar/some-feat`"), ); } diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index 55e15e9f2..246533821 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -239,22 +239,18 @@ fn changing_lib_features_caches_targets() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); assert_that( p.cargo("build").arg("--features").arg("foo"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); } @@ -305,11 +301,9 @@ fn changing_profiles_caches_targets() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( @@ -854,11 +848,10 @@ fn no_rebuild_if_build_artifacts_move_backwards_in_time() { assert_that( p.cargo("build"), - execs().with_status(0).with_stdout("").with_stderr( - "\ -[FINISHED] [..] -", - ), + execs() + .with_status(0) + .with_stdout("") + .with_stderr("[FINISHED] [..]"), ); } @@ -1009,10 +1002,8 @@ fn no_rebuild_when_rename_dir() { assert_that( p.cargo("build").cwd(&new), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); } diff --git a/tests/testsuite/generate_lockfile.rs b/tests/testsuite/generate_lockfile.rs index 0f499d688..6018904f0 100644 --- a/tests/testsuite/generate_lockfile.rs +++ b/tests/testsuite/generate_lockfile.rs @@ -112,11 +112,7 @@ fn no_index_update() { assert_that( p.cargo("generate-lockfile"), - execs().with_stderr( - "\ -[UPDATING] registry `[..]` -", - ), + execs().with_stderr("[UPDATING] registry `[..]`"), ); assert_that( diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index e93ee7c66..d764cc2a3 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -2067,9 +2067,7 @@ fn fetch_downloads() { assert_that( p.cargo("fetch"), execs().with_status(0).with_stderr(&format!( - "\ -[UPDATING] git repository `{url}` -", + "[UPDATING] git repository `{url}`", url = bar.url() )), ); @@ -2260,12 +2258,9 @@ fn update_one_dep_in_repo_with_many_deps() { assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); assert_that( p.cargo("update").arg("-p").arg("foo"), - execs().with_status(0).with_stderr(&format!( - "\ -[UPDATING] git repository `{}` -", - foo.url() - )), + execs() + .with_status(0) + .with_stderr(&format!("[UPDATING] git repository `{}`", foo.url())), ); } diff --git a/tests/testsuite/init.rs b/tests/testsuite/init.rs index 431b47eac..2db179f72 100644 --- a/tests/testsuite/init.rs +++ b/tests/testsuite/init.rs @@ -22,11 +22,9 @@ fn simple_lib() { .arg("--vcs") .arg("none") .env("USER", "foo"), - execs().with_status(0).with_stderr( - "\ -[CREATED] library project -", - ), + execs() + .with_status(0) + .with_stderr("[CREATED] library project"), ); assert_that(&paths::root().join("Cargo.toml"), existing_file()); @@ -47,11 +45,9 @@ fn simple_bin() { .arg("none") .env("USER", "foo") .cwd(&path), - execs().with_status(0).with_stderr( - "\ -[CREATED] binary (application) project -", - ), + execs() + .with_status(0) + .with_stderr("[CREATED] binary (application) project"), ); assert_that(&paths::root().join("foo/Cargo.toml"), existing_file()); @@ -200,9 +196,7 @@ fn confused_by_multiple_lib_files() { .env("USER", "foo") .cwd(&path), execs().with_status(101).with_stderr( - "\ -[ERROR] cannot have a project with multiple libraries, found both `src/lib.rs` and `lib.rs` -", + "[ERROR] cannot have a project with multiple libraries, found both `src/lib.rs` and `lib.rs`", ), ); @@ -608,9 +602,7 @@ fn unknown_flags() { assert_that( cargo_process("init").arg("foo").arg("--flag"), execs().with_status(1).with_stderr_contains( - "\ -error: Found argument '--flag' which wasn't expected, or isn't valid in this context -", + "error: Found argument '--flag' which wasn't expected, or isn't valid in this context", ), ); } @@ -621,9 +613,7 @@ fn no_filename() { assert_that( cargo_process("init").arg("/"), execs().with_status(101).with_stderr( - "\ -[ERROR] cannot auto-detect project name from path \"/\" ; use --name to override -" + "[ERROR] cannot auto-detect project name from path \"/\" ; use --name to override" .to_string(), ), ); diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index 5b2fc6e86..b3e5c5bf3 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -56,9 +56,7 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina assert_that( cargo_process("uninstall").arg("foo"), execs().with_status(0).with_stderr(&format!( - "\ -[REMOVING] {home}[..]bin[..]foo[..] -", + "[REMOVING] {home}[..]bin[..]foo[..]", home = cargo_home().display() )), ); @@ -472,11 +470,9 @@ fn no_binaries_or_examples() { assert_that( cargo_process("install").arg("--path").arg(p.root()), - execs().with_status(101).with_stderr( - "\ -[ERROR] no packages found with binaries or examples -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] no packages found with binaries or examples"), ); } @@ -905,11 +901,9 @@ Caused by: fn uninstall_pkg_does_not_exist() { assert_that( cargo_process("uninstall").arg("foo"), - execs().with_status(101).with_stderr( - "\ -[ERROR] package id specification `foo` matched no packages -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] package id specification `foo` matched no packages"), ); } @@ -920,11 +914,9 @@ fn 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( - "\ -[ERROR] binary `bar[..]` not installed as part of `foo v0.0.1` -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] binary `bar[..]` not installed as part of `foo v0.0.1`"), ); } @@ -953,11 +945,7 @@ fn uninstall_piecemeal() { assert_that( cargo_process("uninstall").arg("foo").arg("--bin=bar"), - execs().with_status(0).with_stderr( - "\ -[REMOVING] [..]bar[..] -", - ), + execs().with_status(0).with_stderr("[REMOVING] [..]bar[..]"), ); assert_that(cargo_home(), has_installed_exe("foo")); @@ -965,21 +953,15 @@ fn uninstall_piecemeal() { assert_that( cargo_process("uninstall").arg("foo").arg("--bin=foo"), - execs().with_status(0).with_stderr( - "\ -[REMOVING] [..]foo[..] -", - ), + execs().with_status(0).with_stderr("[REMOVING] [..]foo[..]"), ); assert_that(cargo_home(), is_not(has_installed_exe("foo"))); assert_that( cargo_process("uninstall").arg("foo"), - execs().with_status(101).with_stderr( - "\ -[ERROR] package id specification `foo` matched no packages -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] package id specification `foo` matched no packages"), ); } @@ -1085,11 +1067,9 @@ fn reports_unsuccessful_subcommand_result() { ); assert_that( cargo_process("fail"), - execs().with_status(101).with_stderr_contains( - "\ -thread '[..]' panicked at 'explicit panic', [..] -", - ), + execs() + .with_status(101) + .with_stderr_contains("thread '[..]' panicked at 'explicit panic', [..]"), ); } @@ -1294,11 +1274,9 @@ fn vers_precise() { .arg("foo") .arg("--vers") .arg("0.1.1"), - execs().with_status(0).with_stderr_contains( - "\ -[DOWNLOADING] foo v0.1.1 (registry [..]) -", - ), + execs() + .with_status(0) + .with_stderr_contains("[DOWNLOADING] foo v0.1.1 (registry [..])"), ); } @@ -1312,11 +1290,9 @@ fn version_too() { .arg("foo") .arg("--version") .arg("0.1.1"), - execs().with_status(0).with_stderr_contains( - "\ - [DOWNLOADING] foo v0.1.1 (registry [..]) -", - ), + execs() + .with_status(0) + .with_stderr_contains("[DOWNLOADING] foo v0.1.1 (registry [..])"), ); } @@ -1361,17 +1337,13 @@ and will continue to do so, but this behavior will be removed eventually #[test] fn test_install_git_cannot_be_a_base_url() { assert_that(cargo_process("install").arg("--git").arg("github.com:rust-lang-nursery/rustfmt.git"), - execs().with_status(101).with_stderr("\ -error: invalid url `github.com:rust-lang-nursery/rustfmt.git`: cannot-be-a-base-URLs are not supported -")); + execs().with_status(101).with_stderr("error: invalid url `github.com:rust-lang-nursery/rustfmt.git`: cannot-be-a-base-URLs are not supported")); } #[test] fn uninstall_multiple_and_specifying_bin() { assert_that(cargo_process("uninstall").args(&["foo", "bar"]).arg("--bin").arg("baz"), - execs().with_status(101).with_stderr("\ -error: A binary can only be associated with a single installed package, specifying multiple specs with --bin is redundant. -")); + execs().with_status(101).with_stderr("error: A binary can only be associated with a single installed package, specifying multiple specs with --bin is redundant.")); } #[test] diff --git a/tests/testsuite/local_registry.rs b/tests/testsuite/local_registry.rs index 6d51b3d5d..4f73d43de 100644 --- a/tests/testsuite/local_registry.rs +++ b/tests/testsuite/local_registry.rs @@ -67,11 +67,7 @@ fn simple() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] [..] -", - ), + execs().with_status(0).with_stderr("[FINISHED] [..]"), ); assert_that(p.cargo("test"), execs().with_status(0)); } @@ -129,11 +125,9 @@ fn multiple_versions() { assert_that( p.cargo("update").arg("-v"), - execs().with_status(0).with_stderr( - "\ -[UPDATING] foo v0.1.0 -> v0.2.0 -", - ), + execs() + .with_status(0) + .with_stderr("[UPDATING] foo v0.1.0 -> v0.2.0"), ); } @@ -491,11 +485,7 @@ fn crates_io_registry_url_is_optional() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] [..] -", - ), + execs().with_status(0).with_stderr("[FINISHED] [..]"), ); assert_that(p.cargo("test"), execs().with_status(0)); } diff --git a/tests/testsuite/metadata.rs b/tests/testsuite/metadata.rs index e3315f9a4..4a2154bd9 100644 --- a/tests/testsuite/metadata.rs +++ b/tests/testsuite/metadata.rs @@ -67,8 +67,7 @@ fn cargo_metadata_warns_on_implicit_version() { .build(); assert_that(p.cargo("metadata"), - execs().with_stderr("\ -[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems")); + execs().with_stderr("[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems")); assert_that( p.cargo("metadata").arg("--format-version").arg("1"), diff --git a/tests/testsuite/net_config.rs b/tests/testsuite/net_config.rs index 546489664..46417ca69 100644 --- a/tests/testsuite/net_config.rs +++ b/tests/testsuite/net_config.rs @@ -70,9 +70,6 @@ fn net_retry_git_outputs_warning() { "[WARNING] spurious network error \ (2 tries remaining): [..]", ) - .with_stderr_contains( - "\ - [WARNING] spurious network error (1 tries remaining): [..]", - ), + .with_stderr_contains("[WARNING] spurious network error (1 tries remaining): [..]"), ); } diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs index eb25a0bbc..64057a058 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -31,11 +31,9 @@ fn simple_lib() { .arg("--vcs") .arg("none") .env("USER", "foo"), - execs().with_status(0).with_stderr( - "\ -[CREATED] library `foo` project -", - ), + execs() + .with_status(0) + .with_stderr("[CREATED] library `foo` project"), ); assert_that(&paths::root().join("foo"), existing_dir()); @@ -77,11 +75,9 @@ fn simple_bin() { .arg("--bin") .arg("foo") .env("USER", "foo"), - execs().with_status(0).with_stderr( - "\ -[CREATED] binary (application) `foo` project -", - ), + execs() + .with_status(0) + .with_stderr("[CREATED] binary (application) `foo` project"), ); assert_that(&paths::root().join("foo"), existing_dir()); @@ -532,9 +528,7 @@ fn unknown_flags() { assert_that( cargo_process("new").arg("foo").arg("--flag"), execs().with_status(1).with_stderr_contains( - "\ -error: Found argument '--flag' which wasn't expected, or isn't valid in this context -", + "error: Found argument '--flag' which wasn't expected, or isn't valid in this context", ), ); } @@ -547,8 +541,7 @@ fn explicit_invalid_name_not_suggested() { .arg("10-invalid") .arg("a"), execs().with_status(101).with_stderr( - "\ - [ERROR] Package names starting with a digit cannot be used as a crate name", + "[ERROR] Package names starting with a digit cannot be used as a crate name", ), ); } diff --git a/tests/testsuite/overrides.rs b/tests/testsuite/overrides.rs index 75660e85b..79a122447 100644 --- a/tests/testsuite/overrides.rs +++ b/tests/testsuite/overrides.rs @@ -498,21 +498,17 @@ fn override_adds_some_deps() { p.cargo("update") .arg("-p") .arg(&format!("{}#bar", foo.url())), - execs().with_status(0).with_stderr( - "\ -[UPDATING] git repository `file://[..]` -", - ), + execs() + .with_status(0) + .with_stderr("[UPDATING] git repository `file://[..]`"), ); assert_that( p.cargo("update") .arg("-p") .arg("https://github.com/rust-lang/crates.io-index#bar"), - execs().with_status(0).with_stderr( - "\ -[UPDATING] registry `file://[..]` -", - ), + execs() + .with_status(0) + .with_stderr("[UPDATING] registry `file://[..]`"), ); assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); @@ -1619,10 +1615,8 @@ fn override_plus_dep() { assert_that( p.cargo("build"), - execs().with_status(101).with_stderr_contains( - "\ -error: cyclic package dependency: [..] -", - ), + execs() + .with_status(101) + .with_stderr_contains("error: cyclic package dependency: [..]"), ); } diff --git a/tests/testsuite/patch.rs b/tests/testsuite/patch.rs index 79b96fc4f..2e47ba84f 100644 --- a/tests/testsuite/patch.rs +++ b/tests/testsuite/patch.rs @@ -564,11 +564,9 @@ fn add_ignored_patch() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("build"), @@ -731,11 +729,9 @@ fn new_major() { assert_that(p.cargo("update"), execs().with_status(0)); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); t!(t!(File::create(p.root().join("Cargo.toml"))).write_all( @@ -1046,11 +1042,7 @@ fn patch_in_virtual() { assert_that(p.cargo("build"), execs().with_status(0)); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] [..] -", - ), + execs().with_status(0).with_stderr("[FINISHED] [..]"), ); } @@ -1114,10 +1106,6 @@ fn patch_depends_on_another_patch() { // Nothing should be rebuilt, no registry should be updated. assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] [..] -", - ), + execs().with_status(0).with_stderr("[FINISHED] [..]"), ); } diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index 3d2b81fc5..49a6ab90b 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -810,10 +810,9 @@ fn bad_license_file() { .arg("-v") .arg("--index") .arg(registry().to_string()), - execs().with_status(101).with_stderr_contains( - "\ - [ERROR] the license file `foo` does not exist", - ), + execs() + .with_status(101) + .with_stderr_contains("[ERROR] the license file `foo` does not exist"), ); } @@ -1150,11 +1149,9 @@ fn update_backtracking_ok() { assert_that( p.cargo("update").arg("-p").arg("hyper"), - execs().with_status(0).with_stderr( - "\ -[UPDATING] registry `[..]` -", - ), + execs() + .with_status(0) + .with_stderr("[UPDATING] registry `[..]`"), ); } @@ -1213,34 +1210,13 @@ fn update_multiple_packages() { p.cargo("build"), execs() .with_status(0) - .with_stderr_contains( - "\ - [DOWNLOADING] a v0.1.1 (registry `file://[..]`)", - ) - .with_stderr_contains( - "\ - [DOWNLOADING] b v0.1.1 (registry `file://[..]`)", - ) - .with_stderr_contains( - "\ - [DOWNLOADING] c v0.1.1 (registry `file://[..]`)", - ) - .with_stderr_contains( - "\ - [COMPILING] a v0.1.1", - ) - .with_stderr_contains( - "\ - [COMPILING] b v0.1.1", - ) - .with_stderr_contains( - "\ - [COMPILING] c v0.1.1", - ) - .with_stderr_contains( - "\ - [COMPILING] foo v0.5.0 ([..])", - ), + .with_stderr_contains("[DOWNLOADING] a v0.1.1 (registry `file://[..]`)") + .with_stderr_contains("[DOWNLOADING] b v0.1.1 (registry `file://[..]`)") + .with_stderr_contains("[DOWNLOADING] c v0.1.1 (registry `file://[..]`)") + .with_stderr_contains("[COMPILING] a v0.1.1") + .with_stderr_contains("[COMPILING] b v0.1.1") + .with_stderr_contains("[COMPILING] c v0.1.1") + .with_stderr_contains("[COMPILING] foo v0.5.0 ([..])"), ); } @@ -1437,11 +1413,9 @@ fn upstream_warnings_on_extra_verbose() { assert_that( p.cargo("build").arg("-vv"), - execs().with_status(0).with_stderr_contains( - "\ -[..]warning: function is never used[..] -", - ), + execs() + .with_status(0) + .with_stderr_contains("[..]warning: function is never used[..]"), ); } diff --git a/tests/testsuite/required_features.rs b/tests/testsuite/required_features.rs index 19737b3e6..93ee37780 100644 --- a/tests/testsuite/required_features.rs +++ b/tests/testsuite/required_features.rs @@ -354,8 +354,7 @@ fn test_default_features() { execs() .with_status(0) .with_stderr(format!( - "\ - [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" + "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )) .with_stdout(""), ); @@ -486,8 +485,7 @@ fn test_multiple_required_features() { execs() .with_status(0) .with_stderr(format!( - "\ - [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" + "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )) .with_stdout(""), ); @@ -547,10 +545,7 @@ fn bench_default_features() { p.cargo("bench").arg("--no-default-features"), execs() .with_status(0) - .with_stderr(format!( - "\ - [FINISHED] release [optimized] target(s) in [..]" - )) + .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]")) .with_stdout(""), ); @@ -714,10 +709,7 @@ fn bench_multiple_required_features() { p.cargo("bench").arg("--no-default-features"), execs() .with_status(0) - .with_stderr(format!( - "\ - [FINISHED] release [optimized] target(s) in [..]" - )) + .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]")) .with_stdout(""), ); } @@ -1121,8 +1113,7 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` execs() .with_status(0) .with_stderr(format!( - "\ - [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" + "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )) .with_stdout(""), ); @@ -1150,10 +1141,7 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` p.cargo("bench"), execs() .with_status(0) - .with_stderr(format!( - "\ - [FINISHED] release [optimized] target(s) in [..]" - )) + .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]")) .with_stdout(""), ); diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index e1f93ed23..2c298aaef 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -33,11 +33,7 @@ fn simple() { [RUNNING] `target[/]debug[/]foo[EXE]`", dir = path2url(p.root()) )) - .with_stdout( - "\ -hello -", - ), + .with_stdout("hello"), ); assert_that(&p.bin("foo"), existing_file()); } @@ -95,11 +91,9 @@ fn simple_quiet_and_verbose() { assert_that( p.cargo("run").arg("-q").arg("-v"), - execs().with_status(101).with_stderr( - "\ -[ERROR] cannot set both --verbose and --quiet -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] cannot set both --verbose and --quiet"), ); } @@ -191,9 +185,7 @@ fn exit_code() { ); if !cfg!(unix) { output.push_str( - "\ -[ERROR] process didn't exit successfully: `target[..]foo[..]` (exit code: 2) -", + "[ERROR] process didn't exit successfully: `target[..]foo[..]` (exit code: 2)", ); } assert_that(p.cargo("run"), execs().with_status(2).with_stderr(output)); @@ -229,9 +221,7 @@ fn exit_code_verbose() { ); if !cfg!(unix) { output.push_str( - "\ -[ERROR] process didn't exit successfully: `target[..]foo[..]` (exit code: 2) -", + "[ERROR] process didn't exit successfully: `target[..]foo[..]` (exit code: 2)", ); } @@ -336,11 +326,7 @@ fn specify_name() { [RUNNING] `target[/]debug[/]a[EXE]`", dir = path2url(p.root()) )) - .with_stdout( - "\ -hello a.rs -", - ), + .with_stdout("hello a.rs"), ); assert_that( @@ -354,11 +340,7 @@ hello a.rs [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] `target[/]debug[/]b[EXE]`", ) - .with_stdout( - "\ -hello b.rs -", - ), + .with_stdout("hello b.rs"), ); } @@ -400,11 +382,7 @@ fn run_example() { [RUNNING] `target[/]debug[/]examples[/]a[EXE]`", dir = path2url(p.root()) )) - .with_stdout( - "\ -example -", - ), + .with_stdout("example"), ); } @@ -438,8 +416,7 @@ fn run_bins() { assert_that( p.cargo("run").arg("--bins"), execs().with_status(1).with_stderr_contains( - "\ - error: Found argument '--bins' which wasn't expected, or isn't valid in this context", + "error: Found argument '--bins' which wasn't expected, or isn't valid in this context", ), ); } @@ -474,10 +451,9 @@ fn run_with_filename() { assert_that( p.cargo("run").arg("--bin").arg("bin.rs"), - execs().with_status(101).with_stderr( - "\ - [ERROR] no bin target named `bin.rs`", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] no bin target named `bin.rs`"), ); assert_that( @@ -492,10 +468,9 @@ Did you mean `a`?", assert_that( p.cargo("run").arg("--example").arg("example.rs"), - execs().with_status(101).with_stderr( - "\ - [ERROR] no example target named `example.rs`", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] no example target named `example.rs`"), ); assert_that( @@ -593,11 +568,7 @@ fn one_bin_multiple_examples() { [RUNNING] `target[/]debug[/]main[EXE]`", dir = path2url(p.root()) )) - .with_stdout( - "\ -hello main.rs -", - ), + .with_stdout("hello main.rs"), ); } @@ -901,11 +872,7 @@ fn run_from_executable_folder() { [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n\ [RUNNING] `.[/]foo[EXE]`", ) - .with_stdout( - "\ -hello -", - ), + .with_stdout("hello"), ); } @@ -1133,9 +1100,7 @@ fn run_multiple_packages() { assert_that(cargo().arg("-p").arg("d1").arg("-p").arg("d2"), execs() .with_status(1) - .with_stderr_contains("\ -error: The argument '--package ' was provided more than once, but cannot be used multiple times -")); + .with_stderr_contains("error: The argument '--package ' was provided more than once, but cannot be used multiple times")); assert_that( cargo().arg("-p").arg("d3"), diff --git a/tests/testsuite/rustdocflags.rs b/tests/testsuite/rustdocflags.rs index 9a22b1683..3102d2408 100644 --- a/tests/testsuite/rustdocflags.rs +++ b/tests/testsuite/rustdocflags.rs @@ -18,11 +18,9 @@ fn parses_env() { assert_that( p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo").arg("-v"), - execs().with_status(0).with_stderr_contains( - "\ -[RUNNING] `rustdoc [..] --cfg=foo[..]` -", - ), + execs() + .with_status(0) + .with_stderr_contains("[RUNNING] `rustdoc [..] --cfg=foo[..]`"), ); } @@ -50,11 +48,9 @@ fn parses_config() { assert_that( p.cargo("doc").arg("-v"), - execs().with_status(0).with_stderr_contains( - "\ -[RUNNING] `rustdoc [..] --cfg foo[..]` -", - ), + execs() + .with_status(0) + .with_stderr_contains("[RUNNING] `rustdoc [..] --cfg foo[..]`"), ); } @@ -100,11 +96,9 @@ fn rerun() { ); assert_that( p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=bar"), diff --git a/tests/testsuite/rustflags.rs b/tests/testsuite/rustflags.rs index 24984e917..1e417a24b 100644 --- a/tests/testsuite/rustflags.rs +++ b/tests/testsuite/rustflags.rs @@ -1616,10 +1616,6 @@ fn two_matching_in_config() { assert_that(p1.cargo("run"), execs().with_status(0)); assert_that( p1.cargo("build"), - execs().with_status(0).with_stderr( - "\ -[FINISHED] [..] -", - ), + execs().with_status(0).with_stderr("[FINISHED] [..]"), ); } diff --git a/tests/testsuite/search.rs b/tests/testsuite/search.rs index 764d37551..a0904da28 100644 --- a/tests/testsuite/search.rs +++ b/tests/testsuite/search.rs @@ -102,8 +102,7 @@ fn simple() { .arg("--index") .arg(registry().to_string()), execs().with_status(0).with_stdout_contains( - "\ - hoare = \"0.1.1\" # Design by contract style assertions for Rust", + "hoare = \"0.1.1\" # Design by contract style assertions for Rust", ), ); } @@ -181,8 +180,7 @@ about this warning. reg = registry() )) .with_stdout_contains( - "\ - hoare = \"0.1.1\" # Design by contract style assertions for Rust", + "hoare = \"0.1.1\" # Design by contract style assertions for Rust", ), ); } @@ -262,8 +260,7 @@ about this warning. reg = registry() )) .with_stdout_contains( - "\ - hoare = \"0.1.1\" # Design by contract style assertions for Rust", + "hoare = \"0.1.1\" # Design by contract style assertions for Rust", ), ); } @@ -323,8 +320,7 @@ fn multiple_query_params() { .arg("--index") .arg(registry().to_string()), execs().with_status(0).with_stdout_contains( - "\ - hoare = \"0.1.1\" # Design by contract style assertions for Rust", + "hoare = \"0.1.1\" # Design by contract style assertions for Rust", ), ); } diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index aa9606a65..3711222ec 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -2174,11 +2174,7 @@ fn example_bin_same_name() { [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] [..]", ) - .with_stdout( - "\ -bin -", - ), + .with_stdout("bin"), ); assert_that(&p.bin("foo"), existing_file()); } @@ -2300,19 +2296,15 @@ fn bad_example() { assert_that( p.cargo("run").arg("--example").arg("foo"), - execs().with_status(101).with_stderr( - "\ -[ERROR] no example target named `foo` -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] no example target named `foo`"), ); assert_that( p.cargo("run").arg("--bin").arg("foo"), - execs().with_status(101).with_stderr( - "\ -[ERROR] no bin target named `foo` -", - ), + execs() + .with_status(101) + .with_stderr("[ERROR] no bin target named `foo`"), ); } @@ -2765,14 +2757,8 @@ fn test_multiple_packages() { p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"), execs() .with_status(0) - .with_stderr_contains( - "\ - [RUNNING] target[/]debug[/]deps[/]d1-[..][EXE]", - ) - .with_stderr_contains( - "\ - [RUNNING] target[/]debug[/]deps[/]d2-[..][EXE]", - ) + .with_stderr_contains("[RUNNING] target[/]debug[/]deps[/]d1-[..][EXE]") + .with_stderr_contains("[RUNNING] target[/]debug[/]deps[/]d2-[..][EXE]") .with_stdout_contains_n("running 0 tests", 2), ); } diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index deba0a16f..191c518f3 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -523,11 +523,9 @@ fn workspace_isnt_root() { assert_that( p.cargo("build"), - execs().with_status(101).with_stderr( - "\ -error: root of a workspace inferred but wasn't a root: [..] -", - ), + execs() + .with_status(101) + .with_stderr("error: root of a workspace inferred but wasn't a root: [..]"), ); } @@ -747,11 +745,9 @@ fn lock_works_for_everyone() { assert_that( p.cargo("generate-lockfile"), - execs().with_status(0).with_stderr( - "\ -[UPDATING] registry `[..]` -", - ), + execs() + .with_status(0) + .with_stderr("[UPDATING] registry `[..]`"), ); Package::new("dep1", "0.1.1").publish(); @@ -1370,11 +1366,9 @@ fn you_cannot_generate_lockfile_for_empty_workspaces() { assert_that( p.cargo("update"), - execs().with_status(101).with_stderr( - "\ -error: you can't generate a lockfile for an empty workspace. -", - ), + execs() + .with_status(101) + .with_stderr("error: you can't generate a lockfile for an empty workspace."), ); } @@ -1455,10 +1449,9 @@ fn error_if_parent_cargo_toml_is_invalid() { assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(101).with_stderr_contains( - "\ - [ERROR] failed to parse manifest at `[..]`", - ), + execs() + .with_status(101) + .with_stderr_contains("[ERROR] failed to parse manifest at `[..]`"), ); } @@ -2142,27 +2135,21 @@ fn dep_used_with_separate_features() { // features are being built separately. Should not rebuild anything assert_that( p.cargo("build").cwd(p.root().join("caller2")), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("build").cwd(p.root().join("caller1")), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("build").cwd(p.root().join("caller2")), - execs().with_status(0).with_stderr( - "\ -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -", - ), + execs() + .with_status(0) + .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); }