Collapse ProcessBuilder::arg calls in tests

.. with mutliple calls of:

    fastmod --accept-all '\.cargo\("([^"]+)"\)\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/

until no changes are left.
This commit is contained in:
Dale Wijnand 2018-08-18 15:05:45 +01:00
parent 8b6f71028f
commit af4f1392f7
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
40 changed files with 509 additions and 509 deletions

View File

@ -40,7 +40,7 @@ fn bad2() {
)
.build();
assert_that(
p.cargo("publish").arg("-v"),
p.cargo("publish -v"),
execs().with_status(101).with_stderr(
"\
[ERROR] could not load Cargo configuration
@ -76,7 +76,7 @@ fn bad3() {
Package::new("foo", "1.0.0").publish();
assert_that(
p.cargo("publish").arg("-v"),
p.cargo("publish -v"),
execs().with_status(101).with_stderr(
"\
error: failed to update registry [..]
@ -100,7 +100,7 @@ fn bad4() {
)
.build();
assert_that(
p.cargo("new").arg("-v").arg("foo"),
p.cargo("new -v foo"),
execs().with_status(101).with_stderr(
"\
[ERROR] Failed to create project `foo` at `[..]`
@ -127,7 +127,7 @@ fn bad6() {
Package::new("foo", "1.0.0").publish();
assert_that(
p.cargo("publish").arg("-v"),
p.cargo("publish -v"),
execs().with_status(101).with_stderr(
"\
error: failed to update registry [..]
@ -152,7 +152,7 @@ fn bad_cargo_config_jobs() {
)
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr(
"\
[ERROR] error in [..].cargo/config: \
@ -175,7 +175,7 @@ fn default_cargo_config_jobs() {
"#,
)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -190,7 +190,7 @@ fn good_cargo_config_jobs() {
"#,
)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -213,7 +213,7 @@ fn invalid_global_config() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr(
"\
[ERROR] could not load Cargo configuration
@ -239,7 +239,7 @@ fn bad_cargo_lock() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse lock file at: [..]Cargo.lock
@ -342,7 +342,7 @@ fn bad_source_in_cargo_lock() {
.build();
assert_that(
p.cargo("build").arg("--verbose"),
p.cargo("build --verbose"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse lock file at: [..]
@ -393,7 +393,7 @@ fn bad_git_dependency() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr(
"\
[UPDATING] git repository `file:///`
@ -431,7 +431,7 @@ fn bad_crate_type() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr_contains(
"error: failed to run `rustc` to learn about crate-type bad_type information",
),
@ -536,7 +536,7 @@ fn duplicate_example_names() {
.build();
assert_that(
p.cargo("build").arg("--example").arg("ex"),
p.cargo("build --example ex"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse manifest at `[..]`
@ -876,7 +876,7 @@ fn ambiguous_git_reference() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr_contains(
"\
[WARNING] dependency (bar) specification is ambiguous. \
@ -1096,7 +1096,7 @@ fn both_git_and_path_specified() {
.build();
assert_that(
foo.cargo("build").arg("-v"),
foo.cargo("build -v"),
execs().with_status(101).with_stderr_contains(
"\
[WARNING] dependency (bar) specification is ambiguous. \
@ -1161,7 +1161,7 @@ fn ignored_git_revision() {
.build();
assert_that(
foo.cargo("build").arg("-v"),
foo.cargo("build -v"),
execs().with_status(101).with_stderr_contains(
"\
[WARNING] key `branch` is ignored for dependency (bar). \

View File

@ -88,7 +88,7 @@ fn bench_bench_implicit() {
.build();
assert_that(
p.cargo("bench").arg("--benches"),
p.cargo("bench --benches"),
execs()
.with_stderr(format!(
"\
@ -136,7 +136,7 @@ fn bench_bin_implicit() {
.build();
assert_that(
p.cargo("bench").arg("--bins"),
p.cargo("bench --bins"),
execs()
.with_stderr(format!(
"\
@ -174,7 +174,7 @@ fn bench_tarname() {
.build();
assert_that(
p.cargo("bench").arg("--bench").arg("bin2"),
p.cargo("bench --bench bin2"),
execs()
.with_stderr(format!(
"\
@ -252,7 +252,7 @@ fn cargo_bench_verbose() {
.build();
assert_that(
p.cargo("bench").arg("-v").arg("hello"),
p.cargo("bench -v hello"),
execs()
.with_stderr(&format!(
"\
@ -361,7 +361,7 @@ fn cargo_bench_failing_test() {
// Force libtest into serial execution so that the test header will be printed.
assert_that(
p.cargo("bench").arg("--").arg("--test-threads=1"),
p.cargo("bench -- --test-threads=1"),
execs()
.with_stdout_contains("test bench_hello ...[..]")
.with_stderr_contains(format!(
@ -746,7 +746,7 @@ fn pass_through_command_line() {
.build();
assert_that(
p.cargo("bench").arg("bar"),
p.cargo("bench bar"),
execs()
.with_stderr(&format!(
"\
@ -759,7 +759,7 @@ fn pass_through_command_line() {
);
assert_that(
p.cargo("bench").arg("foo"),
p.cargo("bench foo"),
execs()
.with_stderr(
"[FINISHED] release [optimized] target(s) in [..]
@ -1031,7 +1031,7 @@ fn bench_dylib() {
.build();
assert_that(
p.cargo("bench").arg("-v"),
p.cargo("bench -v"),
execs()
.with_stderr(&format!(
"\
@ -1051,7 +1051,7 @@ fn bench_dylib() {
p.root().move_into_the_past();
assert_that(
p.cargo("bench").arg("-v"),
p.cargo("bench -v"),
execs()
.with_stderr(&format!(
"\
@ -1192,7 +1192,7 @@ fn bench_with_examples() {
.build();
assert_that(
p.cargo("bench").arg("-v"),
p.cargo("bench -v"),
execs()
.with_stderr(&format!(
"\
@ -1277,7 +1277,7 @@ fn test_bench_no_run() {
.build();
assert_that(
p.cargo("bench").arg("--no-run"),
p.cargo("bench --no-run"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1420,7 +1420,7 @@ fn test_bench_multiple_packages() {
.build();
assert_that(
p.cargo("bench").arg("-p").arg("bar").arg("-p").arg("baz"),
p.cargo("bench -p bar -p baz"),
execs()
.with_stderr_contains("[RUNNING] target/release/deps/bbaz-[..][EXE]")
.with_stdout_contains("test bench_baz ... bench: [..]")
@ -1479,7 +1479,7 @@ fn bench_all_workspace() {
.build();
assert_that(
p.cargo("bench").arg("--all"),
p.cargo("bench --all"),
execs()
.with_stderr_contains("[RUNNING] target/release/deps/bar-[..][EXE]")
.with_stdout_contains("test bench_bar ... bench: [..]")
@ -1526,7 +1526,7 @@ fn bench_all_exclude() {
.build();
assert_that(
p.cargo("bench").arg("--all").arg("--exclude").arg("baz"),
p.cargo("bench --all --exclude baz"),
execs().with_stdout_contains(
"\
running 1 test
@ -1581,7 +1581,7 @@ fn bench_all_virtual_manifest() {
// The order in which bar and baz are built is not guaranteed
assert_that(
p.cargo("bench").arg("--all"),
p.cargo("bench --all"),
execs()
.with_stderr_contains("[RUNNING] target/release/deps/baz-[..][EXE]")
.with_stdout_contains("test bench_baz ... bench: [..]")

View File

@ -35,7 +35,7 @@ fn cargo_fail_with_no_stderr() {
.file("src/foo.rs", &String::from("refusal"))
.build();
assert_that(
p.cargo("build").arg("--message-format=json"),
p.cargo("build --message-format=json"),
execs()
.with_status(101)
.with_stderr_does_not_contain("--- stderr"),
@ -52,14 +52,14 @@ fn cargo_compile_incremental() {
.build();
assert_that(
p.cargo("build").arg("-v").env("CARGO_INCREMENTAL", "1"),
p.cargo("build -v").env("CARGO_INCREMENTAL", "1"),
execs().with_stderr_contains(
"[RUNNING] `rustc [..] -C incremental=[..]/target/debug/incremental[..]`\n",
)
);
assert_that(
p.cargo("test").arg("-v").env("CARGO_INCREMENTAL", "1"),
p.cargo("test -v").env("CARGO_INCREMENTAL", "1"),
execs().with_stderr_contains(
"[RUNNING] `rustc [..] -C incremental=[..]/target/debug/incremental[..]`\n",
)
@ -88,12 +88,12 @@ fn incremental_profile() {
.build();
assert_that(
p.cargo("build").arg("-v").env_remove("CARGO_INCREMENTAL"),
p.cargo("build -v").env_remove("CARGO_INCREMENTAL"),
execs().with_stderr_does_not_contain("[..]C incremental=[..]"),
);
assert_that(
p.cargo("build").arg("-v").env("CARGO_INCREMENTAL", "1"),
p.cargo("build -v").env("CARGO_INCREMENTAL", "1"),
execs().with_stderr_contains("[..]C incremental=[..]"),
);
@ -128,13 +128,13 @@ fn incremental_config() {
.build();
assert_that(
p.cargo("build").arg("-v").env_remove("CARGO_INCREMENTAL"),
p.cargo("build -v").env_remove("CARGO_INCREMENTAL"),
execs()
.with_stderr_does_not_contain("[..]C incremental=[..]"),
);
assert_that(
p.cargo("build").arg("-v").env("CARGO_INCREMENTAL", "1"),
p.cargo("build -v").env("CARGO_INCREMENTAL", "1"),
execs().with_stderr_contains("[..]C incremental=[..]"),
);
}
@ -146,7 +146,7 @@ fn cargo_compile_with_workspace_excluded() {
.build();
assert_that(
p.cargo("build").arg("--all").arg("--exclude").arg("foo"),
p.cargo("build --all --exclude foo"),
execs()
.with_stderr_does_not_contain("[..]virtual[..]")
.with_stderr_contains("[..]no packages to compile")
@ -917,14 +917,14 @@ fn cargo_compile_with_filename() {
.build();
assert_that(
p.cargo("build").arg("--bin").arg("bin.rs"),
p.cargo("build --bin bin.rs"),
execs()
.with_status(101)
.with_stderr("[ERROR] no bin target named `bin.rs`"),
);
assert_that(
p.cargo("build").arg("--bin").arg("a.rs"),
p.cargo("build --bin a.rs"),
execs().with_status(101).with_stderr(
"\
[ERROR] no bin target named `a.rs`
@ -934,14 +934,14 @@ Did you mean `a`?",
);
assert_that(
p.cargo("build").arg("--example").arg("example.rs"),
p.cargo("build --example example.rs"),
execs()
.with_status(101)
.with_stderr("[ERROR] no example target named `example.rs`"),
);
assert_that(
p.cargo("build").arg("--example").arg("a.rs"),
p.cargo("build --example a.rs"),
execs().with_status(101).with_stderr(
"\
[ERROR] no example target named `a.rs`
@ -1381,7 +1381,7 @@ fn cargo_default_env_metadata_env_var() {
// No metadata on libbar since it's a dylib path dependency
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(&format!(
"\
[COMPILING] bar v0.0.1 ({url}/bar)
@ -1502,7 +1502,7 @@ fn crate_env_vars() {
.build();
println!("build");
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
println!("bin");
assert_that(
@ -1512,7 +1512,7 @@ fn crate_env_vars() {
);
println!("test");
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
}
#[test]
@ -1553,7 +1553,7 @@ fn crate_authors_env_vars() {
.build();
println!("build");
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
println!("bin");
assert_that(
@ -1563,7 +1563,7 @@ fn crate_authors_env_vars() {
);
println!("test");
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
}
// The tester may already have LD_LIBRARY_PATH=::/foo/bar which leads to a false positive error
@ -1775,7 +1775,7 @@ fn lto_build() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(
p.cargo("build").arg("-v").arg("--release"),
p.cargo("build -v --release"),
execs().with_stderr(&format!(
"\
[COMPILING] test v0.0.0 ({url})
@ -1800,7 +1800,7 @@ fn verbose_build() {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.1 ({url})
@ -1823,7 +1823,7 @@ fn verbose_release_build() {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v").arg("--release"),
p.cargo("build -v --release"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.1 ({url})
@ -1875,7 +1875,7 @@ fn verbose_release_build_deps() {
.file("foo/src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v").arg("--release"),
p.cargo("build -v --release"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.0 ({url}/foo)
@ -1954,7 +1954,7 @@ fn explicit_examples() {
)
.build();
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
assert_that(
process(&p.bin("examples/hello")),
execs().with_stdout("Hello, World!\n"),
@ -1988,7 +1988,7 @@ fn non_existing_example() {
.build();
assert_that(
p.cargo("test").arg("-v"),
p.cargo("test -v"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse manifest at `[..]`
@ -2008,7 +2008,7 @@ fn non_existing_binary() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse manifest at `[..]`
@ -2039,7 +2039,7 @@ fn legacy_binary_paths_warnings() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr_contains(
"\
[WARNING] path `[..]src/main.rs` was erroneously implicitly accepted for binary `bar`,
@ -2065,7 +2065,7 @@ please set bin.path in Cargo.toml",
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr_contains(
"\
[WARNING] path `[..]src/bin/main.rs` was erroneously implicitly accepted for binary `bar`,
@ -2090,7 +2090,7 @@ please set bin.path in Cargo.toml",
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr_contains(
"\
[WARNING] path `[..]src/bar.rs` was erroneously implicitly accepted for binary `bar`,
@ -2184,7 +2184,7 @@ fn release_build_ndebug() {
)
.build();
assert_that(p.cargo("build").arg("--release"), execs());
assert_that(p.cargo("build --release"), execs());
assert_that(
process(&p.release_bin("foo")),
execs().with_stdout("fast\n"),
@ -2303,7 +2303,7 @@ fn staticlib_rlib_and_bin() {
.file("src/main.rs", "extern crate foo; fn main() { foo::foo(); }")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -2517,7 +2517,7 @@ fn bad_cargo_config() {
.file(".cargo/config", "this is not valid toml")
.build();
assert_that(
foo.cargo("build").arg("-v"),
foo.cargo("build -v"),
execs().with_status(101).with_stderr(
"\
[ERROR] could not load Cargo configuration
@ -2655,7 +2655,7 @@ fn example_as_lib() {
.file("examples/ex.rs", "")
.build();
assert_that(p.cargo("build").arg("--example=ex"), execs());
assert_that(p.cargo("build --example=ex"), execs());
assert_that(&p.example_lib("ex", "lib"), existing_file());
}
@ -2679,7 +2679,7 @@ fn example_as_rlib() {
.file("examples/ex.rs", "")
.build();
assert_that(p.cargo("build").arg("--example=ex"), execs());
assert_that(p.cargo("build --example=ex"), execs());
assert_that(&p.example_lib("ex", "rlib"), existing_file());
}
@ -2703,7 +2703,7 @@ fn example_as_dylib() {
.file("examples/ex.rs", "")
.build();
assert_that(p.cargo("build").arg("--example=ex"), execs());
assert_that(p.cargo("build --example=ex"), execs());
assert_that(&p.example_lib("ex", "dylib"), existing_file());
}
@ -2731,7 +2731,7 @@ fn example_as_proc_macro() {
.file("examples/ex.rs", "#![feature(proc_macro)]")
.build();
assert_that(p.cargo("build").arg("--example=ex"), execs());
assert_that(p.cargo("build --example=ex"), execs());
assert_that(&p.example_lib("ex", "proc-macro"), existing_file());
}
@ -2769,14 +2769,14 @@ fn compile_then_delete() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(p.cargo("run").arg("-v"), execs());
assert_that(p.cargo("run -v"), execs());
assert_that(&p.bin("foo"), existing_file());
if cfg!(windows) {
// On windows unlinking immediately after running often fails, so sleep
sleep_ms(100);
}
fs::remove_file(&p.bin("foo")).unwrap();
assert_that(p.cargo("run").arg("-v"), execs());
assert_that(p.cargo("run -v"), execs());
}
#[test]
@ -2816,7 +2816,7 @@ fn transitive_dependencies_not_available() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
.with_status(101)
.with_stderr_contains("[..] can't find crate for `bbbbb`[..]"),
@ -2854,7 +2854,7 @@ fn cyclic_deps_rejected() {
.file("a/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"),
assert_that(p.cargo("build -v"),
execs().with_status(101)
.with_stderr(
r#"[ERROR] cyclic package dependency: package `a v0.0.1 ([..])` depends on itself. Cycle:
@ -2881,7 +2881,7 @@ fn predictable_filenames() {
.file("src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());
let dylib_name = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX);
assert_that(
@ -2898,7 +2898,7 @@ fn dashes_to_underscores() {
.file("src/main.rs", "extern crate foo_bar; fn main() {}")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
assert_that(&p.bin("foo-bar"), existing_file());
}
@ -2921,7 +2921,7 @@ fn dashes_in_crate_name_bad() {
.file("src/main.rs", "extern crate foo_bar; fn main() {}")
.build();
assert_that(p.cargo("build").arg("-v"), execs().with_status(101));
assert_that(p.cargo("build -v"), execs().with_status(101));
}
#[test]
@ -2956,11 +2956,11 @@ fn filtering() {
.file("examples/b.rs", "fn main() {}")
.build();
assert_that(p.cargo("build").arg("--lib"), execs());
assert_that(p.cargo("build --lib"), execs());
assert_that(&p.bin("a"), is_not(existing_file()));
assert_that(
p.cargo("build").arg("--bin=a").arg("--example=a"),
p.cargo("build --bin=a --example=a"),
execs(),
);
assert_that(&p.bin("a"), existing_file());
@ -2979,7 +2979,7 @@ fn filtering_implicit_bins() {
.file("examples/b.rs", "fn main() {}")
.build();
assert_that(p.cargo("build").arg("--bins"), execs());
assert_that(p.cargo("build --bins"), execs());
assert_that(&p.bin("a"), existing_file());
assert_that(&p.bin("b"), existing_file());
assert_that(&p.bin("examples/a"), is_not(existing_file()));
@ -2996,7 +2996,7 @@ fn filtering_implicit_examples() {
.file("examples/b.rs", "fn main() {}")
.build();
assert_that(p.cargo("build").arg("--examples"), execs());
assert_that(p.cargo("build --examples"), execs());
assert_that(&p.bin("a"), is_not(existing_file()));
assert_that(&p.bin("b"), is_not(existing_file()));
assert_that(&p.bin("examples/a"), existing_file());
@ -3259,7 +3259,7 @@ fn invalid_spec() {
.build();
assert_that(
p.cargo("build").arg("-p").arg("notAValidDep"),
p.cargo("build -p notAValidDep"),
execs()
.with_status(101)
.with_stderr("[ERROR] package id specification `notAValidDep` matched no packages"),
@ -3291,7 +3291,7 @@ fn manifest_with_bom_is_ok() {
)
.file("src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -3312,7 +3312,7 @@ fn panic_abort_compiles_with_panic_abort() {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
.with_stderr_contains("[..] -C panic=abort [..]"),
);
@ -3325,14 +3325,14 @@ fn explicit_color_config_is_propagated_to_rustc() {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v").arg("--color").arg("always"),
p.cargo("build -v --color always"),
execs().with_stderr_contains("[..]rustc [..] src/lib.rs --color always[..]"),
);
assert_that(p.cargo("clean"), execs());
assert_that(
p.cargo("build").arg("-v").arg("--color").arg("never"),
p.cargo("build -v --color never"),
execs().with_stderr(
"\
[COMPILING] test v0.0.0 ([..])
@ -3567,7 +3567,7 @@ fn wrong_message_format_option() {
.build();
assert_that(
p.cargo("build").arg("--message-format").arg("XML"),
p.cargo("build --message-format XML"),
execs().with_status(1).with_stderr_contains(
"\
error: 'XML' isn't a valid value for '--message-format <FMT>'
@ -3671,7 +3671,7 @@ fn cargo_build_empty_target() {
.build();
assert_that(
p.cargo("build").arg("--target").arg(""),
p.cargo("build --target").arg(""),
execs()
.with_status(101)
.with_stderr_contains("[..] target was empty"),
@ -3700,7 +3700,7 @@ fn build_all_workspace() {
.build();
assert_that(
p.cargo("build").arg("--all"),
p.cargo("build --all"),
execs().with_stderr(
"[..] Compiling bar v0.1.0 ([..])\n\
[..] Compiling foo v0.1.0 ([..])\n\
@ -3731,7 +3731,7 @@ fn build_all_exclude() {
.build();
assert_that(
p.cargo("build").arg("--all").arg("--exclude").arg("baz"),
p.cargo("build --all --exclude baz"),
execs()
.with_stderr_contains("[..]Compiling foo v0.1.0 [..]")
.with_stderr_contains("[..]Compiling bar v0.1.0 [..]")
@ -3769,7 +3769,7 @@ fn build_all_workspace_implicit_examples() {
.build();
assert_that(
p.cargo("build").arg("--all").arg("--examples"),
p.cargo("build --all --examples"),
execs().with_stderr(
"[..] Compiling bar v0.1.0 ([..])\n\
[..] Compiling foo v0.1.0 ([..])\n\
@ -3804,7 +3804,7 @@ fn build_all_virtual_manifest() {
// The order in which bar and baz are built is not guaranteed
assert_that(
p.cargo("build").arg("--all"),
p.cargo("build --all"),
execs()
.with_stderr_contains("[..] Compiling baz v0.1.0 ([..])")
.with_stderr_contains("[..] Compiling bar v0.1.0 ([..])")
@ -3863,7 +3863,7 @@ fn build_virtual_manifest_one_project() {
.build();
assert_that(
p.cargo("build").arg("-p").arg("bar"),
p.cargo("build -p bar"),
execs()
.with_stderr_does_not_contain("[..]baz[..]")
.with_stderr_contains("[..] Compiling bar v0.1.0 ([..])")
@ -3900,7 +3900,7 @@ fn build_all_virtual_manifest_implicit_examples() {
// The order in which bar and baz are built is not guaranteed
assert_that(
p.cargo("build").arg("--all").arg("--examples"),
p.cargo("build --all --examples"),
execs()
.with_stderr_contains("[..] Compiling baz v0.1.0 ([..])")
.with_stderr_contains("[..] Compiling bar v0.1.0 ([..])")
@ -3947,7 +3947,7 @@ fn build_all_member_dependency_same_name() {
Package::new("a", "0.1.0").publish();
assert_that(
p.cargo("build").arg("--all"),
p.cargo("build --all"),
execs().with_stderr(
"[..] Updating registry `[..]`\n\
[..] Downloading a v0.1.0 ([..])\n\
@ -3980,7 +3980,7 @@ fn run_proper_binary() {
.build();
assert_that(
p.cargo("run").arg("--bin").arg("other"),
p.cargo("run --bin other"),
execs(),
);
}
@ -3994,7 +3994,7 @@ fn run_proper_binary_main_rs() {
.build();
assert_that(
p.cargo("run").arg("--bin").arg("foo"),
p.cargo("run --bin foo"),
execs(),
);
}
@ -4019,7 +4019,7 @@ fn run_proper_alias_binary_from_src() {
.file("src/bar.rs", r#"fn main() { println!("bar"); }"#)
.build();
assert_that(p.cargo("build").arg("--all"), execs());
assert_that(p.cargo("build --all"), execs());
assert_that(
process(&p.bin("foo")),
execs().with_stdout("foo\n"),
@ -4049,7 +4049,7 @@ fn run_proper_alias_binary_main_rs() {
.file("src/main.rs", r#"fn main() { println!("main"); }"#)
.build();
assert_that(p.cargo("build").arg("--all"), execs());
assert_that(p.cargo("build --all"), execs());
assert_that(
process(&p.bin("foo")),
execs().with_stdout("main\n"),
@ -4069,7 +4069,7 @@ fn run_proper_binary_main_rs_as_foo() {
.build();
assert_that(
p.cargo("run").arg("--bin").arg("foo"),
p.cargo("run --bin foo"),
execs(),
);
}
@ -4203,7 +4203,7 @@ fn deterministic_cfg_flags() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.1.0 [..]
@ -4340,7 +4340,7 @@ fn inferred_tests() {
.build();
assert_that(
p.cargo("test").arg("--test=bar").arg("--test=baz"),
p.cargo("test --test=bar --test=baz"),
execs(),
);
}
@ -4354,7 +4354,7 @@ fn inferred_benchmarks() {
.build();
assert_that(
p.cargo("bench").arg("--bench=bar").arg("--bench=baz"),
p.cargo("bench --bench=bar --bench=baz"),
execs(),
);
}
@ -4381,7 +4381,7 @@ fn target_edition() {
.build();
assert_that(
p.cargo("build").arg("-v").masquerade_as_nightly_cargo(),
p.cargo("build -v").masquerade_as_nightly_cargo(),
execs()
.with_stderr_contains("\
[COMPILING] foo v0.0.1 ([..])
@ -4411,7 +4411,7 @@ fn target_edition_override() {
.build();
assert_that(
p.cargo("build").arg("-v").masquerade_as_nightly_cargo(),
p.cargo("build -v").masquerade_as_nightly_cargo(),
execs().with_stderr_contains("\
[COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc [..]--edition=2015 [..]
@ -4438,7 +4438,7 @@ fn target_edition_feature_gated() {
.build();
assert_that(
p.cargo("build").arg("-v").masquerade_as_nightly_cargo(),
p.cargo("build -v").masquerade_as_nightly_cargo(),
execs().with_status(101).with_stderr(
"\
error: failed to parse manifest at `[..]`
@ -4464,7 +4464,7 @@ fn same_metadata_different_directory() {
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
.build();
let output = t!(String::from_utf8(
t!(p.cargo("build").arg("-v").exec_with_output()).stderr,
t!(p.cargo("build -v").exec_with_output()).stderr,
));
let metadata = output
.split_whitespace()
@ -4477,7 +4477,7 @@ fn same_metadata_different_directory() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
.with_stderr_contains(format!("[..]{}[..]", metadata)),
);
@ -4593,7 +4593,7 @@ fn build_filter_infer_profile() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
.with_stderr_contains(
"\
@ -4609,7 +4609,7 @@ fn build_filter_infer_profile() {
p.root().join("target").rm_rf();
assert_that(
p.cargo("build").arg("-v").arg("--test=t1"),
p.cargo("build -v --test=t1"),
execs()
.with_stderr_contains(
"\
@ -4628,7 +4628,7 @@ fn build_filter_infer_profile() {
p.root().join("target").rm_rf();
assert_that(
p.cargo("build").arg("-v").arg("--bench=b1"),
p.cargo("build -v --bench=b1"),
execs()
.with_stderr_contains(
"\
@ -4654,7 +4654,7 @@ fn targets_selected_default() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
// bin
.with_stderr_contains("\
@ -4677,7 +4677,7 @@ fn targets_selected_all() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(
p.cargo("build").arg("-v").arg("--all-targets"),
p.cargo("build -v --all-targets"),
execs()
// bin
.with_stderr_contains("\
@ -4700,7 +4700,7 @@ fn all_targets_no_lib() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(
p.cargo("build").arg("-v").arg("--all-targets"),
p.cargo("build -v --all-targets"),
execs()
// bin
.with_stderr_contains("\
@ -4792,7 +4792,7 @@ fn invalid_jobs() {
.build();
assert_that(
p.cargo("build").arg("--jobs").arg("over9000"),
p.cargo("build --jobs over9000"),
execs()
.with_status(1)
.with_stderr("error: Invalid value: could not parse `over9000` as a number"),

View File

@ -84,7 +84,7 @@ fn http_auth_offered() {
)
.build();
assert_that(script.cargo("build").arg("-v"), execs());
assert_that(script.cargo("build -v"), execs());
let script = script.bin("script");
let config = paths::home().join(".gitconfig");
@ -186,7 +186,7 @@ fn https_something_happens() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
.with_status(101)
.with_stderr_contains(&format!(
@ -243,7 +243,7 @@ fn ssh_something_happens() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
.with_status(101)
.with_stderr_contains(&format!(

View File

@ -27,7 +27,7 @@ fn build_lib_only() {
.build();
assert_that(
p.cargo("build").arg("--lib").arg("-v"),
p.cargo("build --lib -v"),
execs()
.with_stderr(verbose_output_for_lib(&p)),
);
@ -41,7 +41,7 @@ fn build_with_no_lib() {
.build();
assert_that(
p.cargo("build").arg("--lib"),
p.cargo("build --lib"),
execs()
.with_status(101)
.with_stderr("[ERROR] no library targets found in package `foo`"),

View File

@ -30,7 +30,7 @@ fn custom_build_script_failed() {
.file("build.rs", "fn main() { std::process::exit(101); }")
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr(&format!(
"\
[COMPILING] foo v0.5.0 ({url})
@ -129,7 +129,7 @@ fn custom_build_env_vars() {
let p = p.file("bar/build.rs", &file_content).build();
assert_that(
p.cargo("build").arg("--features").arg("bar_feat"),
p.cargo("build --features bar_feat"),
execs(),
);
}
@ -166,7 +166,7 @@ fn custom_build_env_var_rustc_linker() {
// no crate type set => linker never called => build succeeds if and
// only if build.rs succeeds, despite linker binary not existing.
assert_that(
p.cargo("build").arg("--target").arg(&target),
p.cargo("build --target").arg(&target),
execs(),
);
}
@ -233,7 +233,7 @@ fn custom_build_script_rustc_flags() {
.build();
// TODO: TEST FAILS BECAUSE OF WRONG STDOUT (but otherwise, the build works)
assert_that(p.cargo("build").arg("--verbose"),
assert_that(p.cargo("build --verbose"),
execs().with_status(101)
.with_stderr(&format!("\
[COMPILING] bar v0.5.0 ({url})
@ -451,7 +451,7 @@ fn overrides_and_links() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[..]
@ -497,7 +497,7 @@ fn unused_overrides() {
)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -554,7 +554,7 @@ fn links_passes_env_vars() {
)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -574,14 +574,14 @@ fn only_rerun_build_script() {
.file("build.rs", "fn main() {}")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
p.root().move_into_the_past();
File::create(&p.root().join("some-new-file")).unwrap();
p.root().move_into_the_past();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 (file://[..])
@ -652,13 +652,13 @@ fn rebuild_continues_to_pass_env_vars() {
)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
p.root().move_into_the_past();
File::create(&p.root().join("some-new-file")).unwrap();
p.root().move_into_the_past();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -679,7 +679,7 @@ fn testing_and_such() {
.build();
println!("build");
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
p.root().move_into_the_past();
File::create(&p.root().join("src/lib.rs")).unwrap();
@ -687,7 +687,7 @@ fn testing_and_such() {
println!("test");
assert_that(
p.cargo("test").arg("-vj1"),
p.cargo("test -vj1"),
execs()
.with_stderr(
"\
@ -705,7 +705,7 @@ fn testing_and_such() {
println!("doc");
assert_that(
p.cargo("doc").arg("-v"),
p.cargo("doc -v"),
execs().with_stderr(
"\
[DOCUMENTING] foo v0.5.0 (file://[..])
@ -790,7 +790,7 @@ fn propagation_of_l_flags() {
.build();
assert_that(
p.cargo("build").arg("-v").arg("-j1"),
p.cargo("build -v -j1"),
execs().with_stderr_contains(
"\
[RUNNING] `rustc --crate-name a [..] -L bar[..]-L foo[..]`
@ -866,7 +866,7 @@ fn propagation_of_l_flags_new() {
.build();
assert_that(
p.cargo("build").arg("-v").arg("-j1"),
p.cargo("build -v -j1"),
execs().with_stderr_contains(
"\
[RUNNING] `rustc --crate-name a [..] -L bar[..]-L foo[..]`
@ -906,7 +906,7 @@ fn build_deps_simple() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] a v0.5.0 (file://[..])
@ -954,7 +954,7 @@ fn build_deps_not_for_normal() {
.build();
assert_that(
p.cargo("build").arg("-v").arg("--target").arg(&target),
p.cargo("build -v --target").arg(&target),
execs()
.with_status(101)
.with_stderr_contains("[..]can't find crate for `aaaaa`[..]")
@ -1017,7 +1017,7 @@ fn build_cmd_with_a_build_cmd() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] b v0.5.0 (file://[..])
@ -1077,7 +1077,7 @@ fn out_dir_is_preserved() {
.build();
// Make the file
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
p.root().move_into_the_past();
// Change to asserting that it's there
@ -1095,14 +1095,14 @@ fn out_dir_is_preserved() {
)
.unwrap();
p.root().move_into_the_past();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
// Run a fresh build where file should be preserved
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
// One last time to make sure it's still there.
File::create(&p.root().join("foo")).unwrap();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -1130,7 +1130,7 @@ fn output_separate_lines() {
)
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr_contains(
"\
[COMPILING] foo v0.5.0 (file://[..])
@ -1168,7 +1168,7 @@ fn output_separate_lines_new() {
)
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr_contains(
"\
[COMPILING] foo v0.5.0 (file://[..])
@ -1264,7 +1264,7 @@ fn release_with_build_script() {
.build();
assert_that(
p.cargo("build").arg("-v").arg("--release"),
p.cargo("build -v --release"),
execs(),
);
}
@ -1285,7 +1285,7 @@ fn build_script_only() {
.file("build.rs", r#"fn main() {}"#)
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse manifest at `[..]`
@ -1344,7 +1344,7 @@ fn shared_dep_with_a_build_script() {
)
.file("b/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -1716,7 +1716,7 @@ fn cfg_feedback() {
.file("src/main.rs", "#[cfg(foo)] fn main() {}")
.file("build.rs", r#"fn main() { println!("cargo:rustc-cfg=foo"); }"#)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -1749,7 +1749,7 @@ fn cfg_override() {
)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -1791,7 +1791,7 @@ fn cfg_test() {
.file("tests/test.rs", "#[cfg(foo)] #[test] fn test_bar() {}")
.build();
assert_that(
p.cargo("test").arg("-v"),
p.cargo("test -v"),
execs()
.with_stderr(format!(
"\
@ -1907,7 +1907,7 @@ fn cfg_override_test() {
.file("tests/test.rs", "#[cfg(foo)] #[test] fn test_bar() {}")
.build();
assert_that(
p.cargo("test").arg("-v"),
p.cargo("test -v"),
execs()
.with_stderr(format!(
"\
@ -2009,9 +2009,9 @@ fn env_build() {
)
.file("build.rs", r#"fn main() { println!("cargo:rustc-env=FOO=foo"); }"#)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
assert_that(
p.cargo("run").arg("-v"),
p.cargo("run -v"),
execs().with_stdout("foo\n"),
);
}
@ -2044,7 +2044,7 @@ fn env_test() {
)
.build();
assert_that(
p.cargo("test").arg("-v"),
p.cargo("test -v"),
execs()
.with_stderr(format!(
"\
@ -2089,7 +2089,7 @@ fn env_doc() {
.file("build.rs", r#"fn main() { println!("cargo:rustc-env=FOO=foo"); }"#,
)
.build();
assert_that(p.cargo("doc").arg("-v"), execs());
assert_that(p.cargo("doc -v"), execs());
}
#[test]
@ -2143,7 +2143,7 @@ fn flags_go_into_tests() {
.build();
assert_that(
p.cargo("test").arg("-v").arg("--test=foo"),
p.cargo("test -v --test=foo"),
execs()
.with_stderr(
"\
@ -2163,7 +2163,7 @@ fn flags_go_into_tests() {
);
assert_that(
p.cargo("test").arg("-v").arg("-pb").arg("--lib"),
p.cargo("test -v -pb --lib"),
execs()
.with_stderr(
"\
@ -2242,7 +2242,7 @@ fn diamond_passes_args_only_once() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] c v0.5.0 ([..]
@ -2289,7 +2289,7 @@ fn adding_an_override_invalidates() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
@ -2315,7 +2315,7 @@ fn adding_an_override_invalidates() {
.unwrap();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
@ -2356,7 +2356,7 @@ fn changing_an_override_invalidates() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
@ -2380,7 +2380,7 @@ fn changing_an_override_invalidates() {
.unwrap();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
@ -2424,7 +2424,7 @@ fn fresh_builds_possible_with_link_libs() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
@ -2482,7 +2482,7 @@ fn fresh_builds_possible_with_multiple_metadata_overrides() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
@ -2530,12 +2530,12 @@ fn rebuild_only_on_explicit_paths() {
)
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
// files don't exist, so should always rerun if they don't exist
println!("run without");
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
@ -2553,7 +2553,7 @@ fn 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"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
@ -2566,7 +2566,7 @@ fn rebuild_only_on_explicit_paths() {
println!("run with2");
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[FRESH] foo v0.5.0 ([..])
@ -2581,7 +2581,7 @@ fn rebuild_only_on_explicit_paths() {
println!("run baz");
File::create(p.root().join("baz")).unwrap();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[FRESH] foo v0.5.0 ([..])
@ -2594,7 +2594,7 @@ fn rebuild_only_on_explicit_paths() {
println!("run foo change");
File::create(p.root().join("foo")).unwrap();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
@ -2609,7 +2609,7 @@ fn rebuild_only_on_explicit_paths() {
println!("run foo delete");
fs::remove_file(p.root().join("bar")).unwrap();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
@ -2659,7 +2659,7 @@ fn doctest_receives_build_link_args() {
.build();
assert_that(
p.cargo("test").arg("-v"),
p.cargo("test -v"),
execs().with_stderr_contains(
"[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`",
),
@ -2714,7 +2714,7 @@ fn please_respect_the_dag() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
.with_stderr_contains("[RUNNING] `rustc [..] -L native=foo -L native=bar[..]`"),
);
@ -2754,7 +2754,7 @@ fn non_utf8_output() {
.file("src/main.rs", "#[cfg(foo)] fn main() {}")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -2794,7 +2794,7 @@ fn custom_target_dir() {
.file("a/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -2851,7 +2851,7 @@ fn panic_abort_with_build_scripts() {
.build();
assert_that(
p.cargo("build").arg("-v").arg("--release"),
p.cargo("build -v --release"),
execs(),
);
@ -2889,7 +2889,7 @@ fn warnings_emitted() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
@ -2946,7 +2946,7 @@ fn warnings_hidden_for_upstream() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[UPDATING] registry `[..]`
@ -3005,7 +3005,7 @@ fn warnings_printed_on_vv() {
.build();
assert_that(
p.cargo("build").arg("-vv"),
p.cargo("build -vv"),
execs().with_stderr(
"\
[UPDATING] registry `[..]`
@ -3052,7 +3052,7 @@ fn output_shows_on_vv() {
.build();
assert_that(
p.cargo("build").arg("-vv"),
p.cargo("build -vv"),
execs().with_stdout("stdout").with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
@ -3104,7 +3104,7 @@ fn links_with_dots() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs()
.with_stderr_contains("[RUNNING] `rustc --crate-name foo [..] [..] -L foo[..]`"),
);
@ -3220,15 +3220,15 @@ fn switch_features_rerun() {
.build();
assert_that(
p.cargo("run").arg("-v").arg("--features=foo"),
p.cargo("run -v --features=foo"),
execs().with_stdout("foo\n"),
);
assert_that(
p.cargo("run").arg("-v"),
p.cargo("run -v"),
execs().with_stdout("bar\n"),
);
assert_that(
p.cargo("run").arg("-v").arg("--features=foo"),
p.cargo("run -v --features=foo"),
execs().with_stdout("foo\n"),
);
}
@ -3256,7 +3256,7 @@ fn assume_build_script_when_build_rs_present() {
)
.build();
assert_that(p.cargo("run").arg("-v"), execs());
assert_that(p.cargo("run -v"), execs());
}
#[test]
@ -3292,7 +3292,7 @@ fn if_build_set_to_false_dont_treat_build_rs_as_build_script() {
)
.build();
assert_that(p.cargo("run").arg("-v"), execs());
assert_that(p.cargo("run -v"), execs());
}
#[test]
@ -3405,7 +3405,7 @@ fn deterministic_rustc_dependency_flags() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr_contains(
"\
[RUNNING] `rustc --crate-name foo [..] -L native=test1 -L native=test2 \

View File

@ -16,7 +16,7 @@ fn alias_incorrect_config_type() {
.build();
assert_that(
p.cargo("b-cargo-test").arg("-v"),
p.cargo("b-cargo-test -v"),
execs().with_status(101).with_stderr_contains(
"\
[ERROR] invalid configuration for key `alias.b-cargo-test`
@ -40,7 +40,7 @@ fn alias_default_config_overrides_config() {
.build();
assert_that(
p.cargo("b").arg("-v"),
p.cargo("b -v"),
execs()
.with_stderr_contains("[COMPILING] foo v0.5.0 [..]"),
);
@ -111,7 +111,7 @@ fn alias_list_test() {
.build();
assert_that(
p.cargo("b-cargo-test").arg("-v"),
p.cargo("b-cargo-test -v"),
execs()
.with_stderr_contains("[COMPILING] foo v0.5.0 [..]")
.with_stderr_contains("[RUNNING] `rustc --crate-name [..]"),
@ -133,7 +133,7 @@ fn alias_with_flags_config() {
.build();
assert_that(
p.cargo("b-cargo-test").arg("-v"),
p.cargo("b-cargo-test -v"),
execs()
.with_stderr_contains("[COMPILING] foo v0.5.0 [..]")
.with_stderr_contains("[RUNNING] `rustc --crate-name foo [..]"),

View File

@ -273,7 +273,7 @@ fn z_flags_rejected() {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-Zprint-im-a-teapot"),
p.cargo("build -Zprint-im-a-teapot"),
execs()
.with_status(101)
.with_stderr("error: the `-Z` flag is only accepted on the nightly channel of Cargo"),

View File

@ -162,7 +162,7 @@ fn cfg_easy() {
.file("b/Cargo.toml", &basic_manifest("b", "0.0.1"))
.file("b/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -383,7 +383,7 @@ fn multiple_match_ok() {
.file("b/Cargo.toml", &basic_manifest("b", "0.0.1"))
.file("b/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -405,7 +405,7 @@ fn any_ok() {
.file("b/Cargo.toml", &basic_manifest("b", "0.0.1"))
.file("b/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
// https://github.com/rust-lang/cargo/issues/5313

View File

@ -185,7 +185,7 @@ fn issue_3418() {
.build();
assert_that(
foo.cargo("check").arg("-v"),
foo.cargo("check -v"),
execs()
.with_stderr_contains("[..] --emit=dep-info,metadata [..]"),
);
@ -384,7 +384,7 @@ fn check_all() {
.build();
assert_that(
p.cargo("check").arg("--all").arg("-v"),
p.cargo("check --all -v"),
execs()
.with_stderr_contains("[..] --crate-name foo src/lib.rs [..]")
.with_stderr_contains("[..] --crate-name foo src/main.rs [..]")
@ -410,7 +410,7 @@ fn check_virtual_all_implied() {
.build();
assert_that(
p.cargo("check").arg("-v"),
p.cargo("check -v"),
execs()
.with_stderr_contains("[..] --crate-name bar bar/src/lib.rs [..]")
.with_stderr_contains("[..] --crate-name baz baz/src/lib.rs [..]"),
@ -428,7 +428,7 @@ fn targets_selected_default() {
.build();
assert_that(
foo.cargo("check").arg("-v"),
foo.cargo("check -v"),
execs()
.with_stderr_contains("[..] --crate-name foo src/lib.rs [..]")
.with_stderr_contains("[..] --crate-name foo src/main.rs [..]")
@ -449,7 +449,7 @@ fn targets_selected_all() {
.build();
assert_that(
foo.cargo("check").arg("--all-targets").arg("-v"),
foo.cargo("check --all-targets -v"),
execs()
.with_stderr_contains("[..] --crate-name foo src/lib.rs [..]")
.with_stderr_contains("[..] --crate-name foo src/main.rs [..]")
@ -478,7 +478,7 @@ fn check_unit_test_profile() {
assert_that(foo.cargo("check"), execs());
assert_that(
foo.cargo("check").arg("--profile").arg("test"),
foo.cargo("check --profile test"),
execs()
.with_status(101)
.with_stderr_contains("[..]badtext[..]"),
@ -555,7 +555,7 @@ fn check_filters() {
);
p.root().join("target").rm_rf();
assert_that(
p.cargo("check").arg("--tests").arg("-v"),
p.cargo("check --tests -v"),
execs()
.with_stderr_contains("[..] --crate-name foo src/lib.rs [..] --test [..]")
.with_stderr_contains("[..] --crate-name foo src/lib.rs --crate-type lib [..]")
@ -573,7 +573,7 @@ fn check_filters() {
);
p.root().join("target").rm_rf();
assert_that(
p.cargo("check").arg("--test").arg("t1").arg("-v"),
p.cargo("check --test t1 -v"),
execs()
.with_stderr_contains("[..]unused_normal_lib[..]")
.with_stderr_contains("[..]unused_unit_t1[..]")
@ -587,7 +587,7 @@ fn check_filters() {
);
p.root().join("target").rm_rf();
assert_that(
p.cargo("check").arg("--all-targets").arg("-v"),
p.cargo("check --all-targets -v"),
execs()
.with_stderr_contains("[..]unused_normal_lib[..]")
.with_stderr_contains("[..]unused_normal_bin[..]")
@ -624,7 +624,7 @@ fn check_artifacts() {
);
p.root().join("target").rm_rf();
assert_that(p.cargo("check").arg("--lib"), execs());
assert_that(p.cargo("check --lib"), execs());
assert_that(&p.root().join("target/debug/libfoo.rmeta"), existing_file());
assert_that(
&p.root().join("target/debug/libfoo.rlib"),
@ -637,7 +637,7 @@ fn check_artifacts() {
p.root().join("target").rm_rf();
assert_that(
p.cargo("check").arg("--bin").arg("foo"),
p.cargo("check --bin foo"),
execs(),
);
if is_nightly() {
@ -657,7 +657,7 @@ fn check_artifacts() {
p.root().join("target").rm_rf();
assert_that(
p.cargo("check").arg("--test").arg("t1"),
p.cargo("check --test t1"),
execs(),
);
assert_that(
@ -681,7 +681,7 @@ fn check_artifacts() {
p.root().join("target").rm_rf();
assert_that(
p.cargo("check").arg("--example").arg("ex1"),
p.cargo("check --example ex1"),
execs(),
);
assert_that(
@ -699,7 +699,7 @@ fn check_artifacts() {
p.root().join("target").rm_rf();
assert_that(
p.cargo("check").arg("--bench").arg("b1"),
p.cargo("check --bench b1"),
execs(),
);
assert_that(
@ -780,7 +780,7 @@ fn proc_macro() {
)
.build();
assert_that(
p.cargo("check").arg("-v").env("RUST_LOG", "cargo=trace"),
p.cargo("check -v").env("RUST_LOG", "cargo=trace"),
execs(),
);
}

View File

@ -105,23 +105,23 @@ fn clean_release() {
.file("a/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("--release"), execs());
assert_that(p.cargo("build --release"), execs());
assert_that(
p.cargo("clean").arg("-p").arg("foo"),
p.cargo("clean -p foo"),
execs(),
);
assert_that(
p.cargo("build").arg("--release"),
p.cargo("build --release"),
execs().with_stdout(""),
);
assert_that(
p.cargo("clean").arg("-p").arg("foo").arg("--release"),
p.cargo("clean -p foo --release"),
execs(),
);
assert_that(
p.cargo("build").arg("--release"),
p.cargo("build --release"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -157,7 +157,7 @@ fn clean_doc() {
assert_that(doc_path, existing_dir());
assert_that(p.cargo("clean").arg("--doc"), execs());
assert_that(p.cargo("clean --doc"), execs());
assert_that(doc_path, is_not(existing_dir()));
assert_that(p.build_dir(), existing_dir());
@ -198,11 +198,11 @@ fn build_script() {
assert_that(p.cargo("build").env("FIRST", "1"), execs());
assert_that(
p.cargo("clean").arg("-p").arg("foo"),
p.cargo("clean -p foo"),
execs(),
);
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -244,7 +244,7 @@ fn clean_git() {
assert_that(p.cargo("build"), execs());
assert_that(
p.cargo("clean").arg("-p").arg("dep"),
p.cargo("clean -p dep"),
execs().with_stdout(""),
);
assert_that(p.cargo("build"), execs());
@ -272,7 +272,7 @@ fn registry() {
assert_that(p.cargo("build"), execs());
assert_that(
p.cargo("clean").arg("-p").arg("bar"),
p.cargo("clean -p bar"),
execs().with_stdout(""),
);
assert_that(p.cargo("build"), execs());
@ -299,7 +299,7 @@ fn clean_verbose() {
assert_that(p.cargo("build"), execs());
assert_that(
p.cargo("clean").arg("-p").arg("bar").arg("--verbose"),
p.cargo("clean -p bar --verbose"),
execs().with_stderr(
"\
[REMOVING] [..]

View File

@ -445,7 +445,7 @@ fn debug_release_ok() {
fs::remove_dir_all(p.root().join("target")).unwrap();
let mut a = p.cargo("build").build_command();
let mut b = p.cargo("build").arg("--release").build_command();
let mut b = p.cargo("build --release").build_command();
a.stdout(Stdio::piped()).stderr(Stdio::piped());
b.stdout(Stdio::piped()).stderr(Stdio::piped());
let a = a.spawn().unwrap();

View File

@ -47,7 +47,7 @@ fn simple_cross() {
let target = cross_compile::alternate();
assert_that(
p.cargo("build").arg("--target").arg(&target).arg("-v"),
p.cargo("build --target").arg(&target).arg("-v"),
execs(),
);
assert_that(&p.target_bin(&target, "foo"), existing_file());
@ -111,7 +111,7 @@ fn simple_cross_config() {
.build();
let target = cross_compile::alternate();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
assert_that(&p.target_bin(&target, "foo"), existing_file());
assert_that(
@ -148,7 +148,7 @@ fn simple_deps() {
let target = cross_compile::alternate();
assert_that(
p.cargo("build").arg("--target").arg(&target),
p.cargo("build --target").arg(&target),
execs(),
);
assert_that(&p.target_bin(&target, "foo"), existing_file());
@ -244,7 +244,7 @@ fn plugin_deps() {
let target = cross_compile::alternate();
assert_that(
foo.cargo("build").arg("--target").arg(&target),
foo.cargo("build --target").arg(&target),
execs(),
);
assert_that(&foo.target_bin(&target, "foo"), existing_file());
@ -347,12 +347,12 @@ fn plugin_to_the_max() {
let target = cross_compile::alternate();
assert_that(
foo.cargo("build").arg("--target").arg(&target).arg("-v"),
foo.cargo("build --target").arg(&target).arg("-v"),
execs(),
);
println!("second");
assert_that(
foo.cargo("build").arg("-v").arg("--target").arg(&target),
foo.cargo("build -v --target").arg(&target),
execs(),
);
assert_that(&foo.target_bin(&target, "foo"), existing_file());
@ -398,7 +398,7 @@ fn linker_and_ar() {
.build();
assert_that(
p.cargo("build").arg("--target").arg(&target).arg("-v"),
p.cargo("build --target").arg(&target).arg("-v"),
execs().with_status(101).with_stderr_contains(&format!(
"\
[COMPILING] foo v0.5.0 ({url})
@ -503,7 +503,7 @@ fn plugin_with_extra_dylib_dep() {
let target = cross_compile::alternate();
assert_that(
foo.cargo("build").arg("--target").arg(&target),
foo.cargo("build --target").arg(&target),
execs(),
);
}
@ -557,7 +557,7 @@ fn cross_tests() {
let target = cross_compile::alternate();
assert_that(
p.cargo("test").arg("--target").arg(&target),
p.cargo("test --target").arg(&target),
execs()
.with_stderr(&format!(
"\
@ -610,7 +610,7 @@ fn no_cross_doctests() {
println!("b");
let target = cross_compile::host();
assert_that(
p.cargo("test").arg("--target").arg(&target),
p.cargo("test --target").arg(&target),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.1 ({foo})
@ -626,7 +626,7 @@ fn no_cross_doctests() {
println!("c");
let target = cross_compile::alternate();
assert_that(
p.cargo("test").arg("--target").arg(&target),
p.cargo("test --target").arg(&target),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.1 ({foo})
@ -662,7 +662,7 @@ fn simple_cargo_run() {
let target = cross_compile::alternate();
assert_that(
p.cargo("run").arg("--target").arg(&target),
p.cargo("run --target").arg(&target),
execs(),
);
}
@ -715,7 +715,7 @@ fn cross_with_a_build_script() {
.build();
assert_that(
p.cargo("build").arg("--target").arg(&target).arg("-v"),
p.cargo("build --target").arg(&target).arg("-v"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.0 (file://[..])
@ -814,7 +814,7 @@ fn build_script_needed_for_host_and_target() {
.build();
assert_that(
p.cargo("build").arg("--target").arg(&target).arg("-v"),
p.cargo("build --target").arg(&target).arg("-v"),
execs()
.with_stderr_contains(&format!(
"[COMPILING] d1 v0.0.0 ({url}/d1)",
@ -896,7 +896,7 @@ fn build_deps_for_the_right_arch() {
let target = cross_compile::alternate();
assert_that(
p.cargo("build").arg("--target").arg(&target).arg("-v"),
p.cargo("build --target").arg(&target).arg("-v"),
execs(),
);
}
@ -950,7 +950,7 @@ fn build_script_only_host() {
let target = cross_compile::alternate();
assert_that(
p.cargo("build").arg("--target").arg(&target).arg("-v"),
p.cargo("build --target").arg(&target).arg("-v"),
execs(),
);
}
@ -1048,7 +1048,7 @@ fn build_script_with_platform_specific_dependencies() {
.build();
assert_that(
p.cargo("build").arg("-v").arg("--target").arg(&target),
p.cargo("build -v --target").arg(&target),
execs().with_stderr(&format!(
"\
[COMPILING] d2 v0.0.0 ([..])
@ -1115,7 +1115,7 @@ fn platform_specific_dependencies_do_not_leak() {
.build();
assert_that(
p.cargo("build").arg("-v").arg("--target").arg(&target),
p.cargo("build -v --target").arg(&target),
execs()
.with_status(101)
.with_stderr_contains("[..] can't find crate for `d2`[..]"),
@ -1204,9 +1204,9 @@ fn platform_specific_variables_reflected_in_build_scripts() {
.file("d2/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
assert_that(
p.cargo("build").arg("-v").arg("--target").arg(&target),
p.cargo("build -v --target").arg(&target),
execs(),
);
}
@ -1284,7 +1284,7 @@ fn cross_test_dylib() {
.build();
assert_that(
p.cargo("test").arg("--target").arg(&target),
p.cargo("test --target").arg(&target),
execs()
.with_stderr(&format!(
"\

View File

@ -43,7 +43,7 @@ fn simple_cross_package() {
let target = cross_compile::alternate();
assert_that(
p.cargo("package").arg("--target").arg(&target),
p.cargo("package --target").arg(&target),
execs().with_stderr(&format!(
" Packaging foo v0.0.0 ({dir})
Verifying foo v0.0.0 ({dir})

View File

@ -37,7 +37,7 @@ fn build_dep_info_lib() {
.file("examples/ex.rs", "")
.build();
assert_that(p.cargo("build").arg("--example=ex"), execs());
assert_that(p.cargo("build --example=ex"), execs());
assert_that(
&p.example_lib("ex", "lib").with_extension("d"),
existing_file(),
@ -64,7 +64,7 @@ fn build_dep_info_rlib() {
.file("examples/ex.rs", "")
.build();
assert_that(p.cargo("build").arg("--example=ex"), execs());
assert_that(p.cargo("build --example=ex"), execs());
assert_that(
&p.example_lib("ex", "rlib").with_extension("d"),
existing_file(),
@ -91,7 +91,7 @@ fn build_dep_info_dylib() {
.file("examples/ex.rs", "")
.build();
assert_that(p.cargo("build").arg("--example=ex"), execs());
assert_that(p.cargo("build --example=ex"), execs());
assert_that(
&p.example_lib("ex", "dylib").with_extension("d"),
existing_file(),

View File

@ -168,7 +168,7 @@ fn doc_no_deps() {
.build();
assert_that(
p.cargo("doc").arg("--no-deps"),
p.cargo("doc --no-deps"),
execs().with_stderr(&format!(
"\
[CHECKING] bar v0.0.1 ({dir}/bar)
@ -207,7 +207,7 @@ fn doc_only_bin() {
.file("bar/src/lib.rs", "pub fn bar() {}")
.build();
assert_that(p.cargo("doc").arg("-v"), execs());
assert_that(p.cargo("doc -v"), execs());
assert_that(&p.root().join("target/doc"), existing_dir());
assert_that(&p.root().join("target/doc/bar/index.html"), existing_file());
@ -248,7 +248,7 @@ fn doc_multiple_targets_same_name_lib() {
.build();
assert_that(
p.cargo("doc").arg("--all"),
p.cargo("doc --all"),
execs()
.with_status(101)
.with_stderr_contains("[..] library `foo_lib` is specified [..]")
@ -295,7 +295,7 @@ fn doc_multiple_targets_same_name() {
let root = path2url(p.root());
assert_that(
p.cargo("doc").arg("--all"),
p.cargo("doc --all"),
execs()
.with_stderr_contains(&format!("[DOCUMENTING] foo v0.1.0 ({}/foo)", root))
.with_stderr_contains(&format!("[DOCUMENTING] bar v0.1.0 ({}/bar)", root))
@ -341,7 +341,7 @@ fn doc_multiple_targets_same_name_bin() {
.build();
assert_that(
p.cargo("doc").arg("--all"),
p.cargo("doc --all"),
execs()
.with_status(101)
.with_stderr_contains("[..] binary `foo_cli` is specified [..]")
@ -385,7 +385,7 @@ fn doc_multiple_targets_same_name_undoced() {
.file("bar/src/foo-cli.rs", "")
.build();
assert_that(p.cargo("doc").arg("--all"), execs());
assert_that(p.cargo("doc --all"), execs());
}
#[test]
@ -455,7 +455,7 @@ fn doc_lib_bin_same_name_documents_lib_when_requested() {
.build();
assert_that(
p.cargo("doc").arg("--lib"),
p.cargo("doc --lib"),
execs().with_stderr(&format!(
"\
[DOCUMENTING] foo v0.0.1 ({dir})
@ -499,7 +499,7 @@ fn doc_lib_bin_same_name_documents_named_bin_when_requested() {
.build();
assert_that(
p.cargo("doc").arg("--bin").arg("foo"),
p.cargo("doc --bin foo"),
execs().with_stderr(&format!(
"\
[CHECKING] foo v0.0.1 ({dir})
@ -544,7 +544,7 @@ fn doc_lib_bin_same_name_documents_bins_when_requested() {
.build();
assert_that(
p.cargo("doc").arg("--bins"),
p.cargo("doc --bins"),
execs().with_stderr(&format!(
"\
[CHECKING] foo v0.0.1 ({dir})
@ -600,7 +600,7 @@ fn doc_dash_p() {
.build();
assert_that(
p.cargo("doc").arg("-p").arg("a"),
p.cargo("doc -p a"),
execs().with_stderr(
"\
[..] b v0.0.1 (file://[..])
@ -643,7 +643,7 @@ fn doc_target() {
.build();
assert_that(
p.cargo("doc").arg("--target").arg(TARGET).arg("--verbose"),
p.cargo("doc --target").arg(TARGET).arg("--verbose"),
execs(),
);
assert_that(
@ -806,9 +806,9 @@ fn doc_release() {
.file("src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("--release"), execs());
assert_that(p.cargo("build --release"), execs());
assert_that(
p.cargo("doc").arg("--release").arg("-v"),
p.cargo("doc --release -v"),
execs().with_stderr(
"\
[DOCUMENTING] foo v0.0.1 ([..])
@ -901,7 +901,7 @@ fn features() {
.file("bar/src/lib.rs", r#"#[cfg(feature = "bar")] pub fn bar() {}"#)
.build();
assert_that(
p.cargo("doc").arg("--features").arg("foo"),
p.cargo("doc --features foo"),
execs(),
);
assert_that(&p.root().join("target/doc"), existing_dir());
@ -957,7 +957,7 @@ fn document_only_lib() {
"#,
)
.build();
assert_that(p.cargo("doc").arg("--lib"), execs());
assert_that(p.cargo("doc --lib"), execs());
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
}
@ -1012,7 +1012,7 @@ fn doc_all_workspace() {
// The order in which bar is compiled or documented is not deterministic
assert_that(
p.cargo("doc").arg("--all"),
p.cargo("doc --all"),
execs()
.with_stderr_contains("[..] Documenting bar v0.1.0 ([..])")
.with_stderr_contains("[..] Checking bar v0.1.0 ([..])")
@ -1038,7 +1038,7 @@ fn doc_all_virtual_manifest() {
// The order in which bar and baz are documented is not guaranteed
assert_that(
p.cargo("doc").arg("--all"),
p.cargo("doc --all"),
execs()
.with_stderr_contains("[..] Documenting baz v0.1.0 ([..])")
.with_stderr_contains("[..] Documenting bar v0.1.0 ([..])"),
@ -1101,7 +1101,7 @@ fn doc_all_member_dependency_same_name() {
Package::new("bar", "0.1.0").publish();
assert_that(
p.cargo("doc").arg("--all"),
p.cargo("doc --all"),
execs()
.with_stderr_contains("[..] Updating registry `[..]`")
.with_stderr_contains("[..] Documenting bar v0.1.0 ([..])"),
@ -1126,7 +1126,7 @@ fn doc_workspace_open_help_message() {
// The order in which bar is compiled or documented is not deterministic
assert_that(
p.cargo("doc").arg("--all").arg("--open"),
p.cargo("doc --all --open"),
execs()
.with_status(101)
.with_stderr_contains("[..] Documenting bar v0.1.0 ([..])")
@ -1353,7 +1353,7 @@ fn doc_private_items() {
let foo = project()
.file("src/lib.rs", "mod private { fn private_item() {} }")
.build();
assert_that(foo.cargo("doc").arg("--document-private-items"), execs());
assert_that(foo.cargo("doc --document-private-items"), execs());
assert_that(&foo.root().join("target/doc"), existing_dir());
assert_that(&foo.root().join("target/doc/foo/private/index.html"), existing_file());

View File

@ -146,7 +146,7 @@ failed to select a version for `bar` which could resolve this conflict",
p.change_file("Cargo.toml", &basic_manifest("foo", "0.0.1"));
assert_that(
p.cargo("build").arg("--features").arg("test"),
p.cargo("build --features test"),
execs()
.with_status(101)
.with_stderr("error: Package `foo v0.0.1 ([..])` does not have these features: `test`"),
@ -204,7 +204,7 @@ fn invalid6() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("foo"),
p.cargo("build --features foo"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse manifest at `[..]`
@ -236,7 +236,7 @@ fn invalid7() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("foo"),
p.cargo("build --features foo"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse manifest at `[..]`
@ -270,7 +270,7 @@ fn invalid8() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("foo"),
p.cargo("build --features foo"),
execs()
.with_status(101)
.with_stderr("[ERROR] feature names may not contain slashes: `foo/bar`"),
@ -297,7 +297,7 @@ fn invalid9() {
.file("bar/src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("--features").arg("bar"),
assert_that(p.cargo("build --features bar"),
execs().with_stderr("\
warning: Package `foo v0.0.1 ([..])` does not have feature `bar`. It has a required dependency with \
that name, but only optional dependencies can be used as features. [..]
@ -465,7 +465,7 @@ fn no_feature_doesnt_build() {
);
assert_that(
p.cargo("build").arg("--features").arg("bar"),
p.cargo("build --features bar"),
execs().with_stderr(format!(
"\
[COMPILING] bar v0.0.1 ({dir}/bar)
@ -532,7 +532,7 @@ fn default_feature_pulled_in() {
);
assert_that(
p.cargo("build").arg("--no-default-features"),
p.cargo("build --no-default-features"),
execs().with_stderr(format!(
"\
[COMPILING] foo v0.0.1 ({dir})
@ -692,7 +692,7 @@ fn many_cli_features() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("bar baz"),
p.cargo("build --features bar baz"),
execs().with_stderr(format!(
"\
[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
@ -838,7 +838,7 @@ fn many_features_no_rebuilds() {
p.root().move_into_the_past();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[FRESH] a v0.1.0 ([..]/a)
@ -857,7 +857,7 @@ fn empty_features() {
.build();
assert_that(
p.cargo("build").arg("--features").arg(""),
p.cargo("build --features").arg(""),
execs(),
);
}
@ -898,7 +898,7 @@ fn transitive_features() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("foo"),
p.cargo("build --features foo"),
execs(),
);
}
@ -1150,7 +1150,7 @@ fn activating_feature_activates_dep() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("a").arg("-v"),
p.cargo("build --features a -v"),
execs(),
);
}
@ -1230,7 +1230,7 @@ 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"),
p.cargo("build --features bar/some-feat"),
execs()
.with_status(101)
.with_stderr("error: Package `foo v0.0.1 ([..])` does not have these features: `bar`"),
@ -1290,7 +1290,7 @@ fn all_features_flag_enables_all_features() {
.build();
assert_that(
p.cargo("build").arg("--all-features"),
p.cargo("build --all-features"),
execs(),
);
}
@ -1332,7 +1332,7 @@ fn many_cli_features_comma_delimited() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("bar,baz"),
p.cargo("build --features bar,baz"),
execs().with_stderr(format!(
"\
[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
@ -1398,7 +1398,7 @@ fn many_cli_features_comma_and_space_delimited() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("bar,baz bam bap"),
p.cargo("build --features bar,baz bam bap"),
execs().with_stderr(format!(
"\
[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])

View File

@ -104,14 +104,14 @@ fn fetch_platform_specific_dependencies() {
.build();
assert_that(
p.cargo("fetch").arg("--target").arg(&host),
p.cargo("fetch --target").arg(&host),
execs()
.with_stderr_contains("[..] Downloading d1 v1.2.3 [..]")
.with_stderr_does_not_contain("[..] Downloading d2 v0.1.2 [..]"),
);
assert_that(
p.cargo("fetch").arg("--target").arg(&target),
p.cargo("fetch --target").arg(&target),
execs()
.with_stderr_contains("[..] Downloading d2 v0.1.2[..]")
.with_stderr_does_not_contain("[..] Downloading d1 v1.2.3 [..]"),

View File

@ -141,7 +141,7 @@ fn rebuild_sub_package_then_while_package() {
.write_all(br#"pub fn b() {}"#)
.unwrap();
assert_that(p.cargo("build").arg("-pb"), execs());
assert_that(p.cargo("build -pb"), execs());
File::create(&p.root().join("src/lib.rs"))
.unwrap()
@ -180,7 +180,7 @@ fn changing_lib_features_caches_targets() {
);
assert_that(
p.cargo("build").arg("--features").arg("foo"),
p.cargo("build --features foo"),
execs().with_stderr(
"\
[..]Compiling foo v0.0.1 ([..])
@ -200,7 +200,7 @@ fn changing_lib_features_caches_targets() {
assert_that(p.cargo("build"), execs().with_stdout(""));
assert_that(
p.cargo("build").arg("--features").arg("foo"),
p.cargo("build --features foo"),
execs()
.with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
@ -255,7 +255,7 @@ fn changing_profiles_caches_targets() {
);
assert_that(
p.cargo("test").arg("foo"),
p.cargo("test foo"),
execs().with_stderr(
"\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
@ -364,7 +364,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
),
);
assert_that(
p.cargo("clean").arg("-p").arg("a").cwd(p.root().join("a")),
p.cargo("clean -p a").cwd(p.root().join("a")),
execs(),
);
assert_that(
@ -391,7 +391,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
),
);
assert_that(
p.cargo("clean").arg("-p").arg("b").cwd(p.root().join("b")),
p.cargo("clean -p b").cwd(p.root().join("b")),
execs(),
);
assert_that(
@ -408,7 +408,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
/* Build a/ package again. If we cache different feature dep builds correctly,
* this should not cause a rebuild of dep_crate */
assert_that(
p.cargo("clean").arg("-p").arg("a").cwd(p.root().join("a")),
p.cargo("clean -p a").cwd(p.root().join("a")),
execs(),
);
assert_that(
@ -425,7 +425,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
/* Build b/ package again. If we cache different feature dep builds correctly,
* this should not cause a rebuild */
assert_that(
p.cargo("clean").arg("-p").arg("b").cwd(p.root().join("b")),
p.cargo("clean -p b").cwd(p.root().join("b")),
execs(),
);
assert_that(
@ -492,7 +492,7 @@ fn changing_bin_features_caches_targets() {
);
assert_that(
p.cargo("build").arg("--features").arg("foo"),
p.cargo("build --features foo"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -521,7 +521,7 @@ fn changing_bin_features_caches_targets() {
);
assert_that(
p.cargo("build").arg("--features").arg("foo"),
p.cargo("build --features foo"),
execs().with_stderr(
"\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
@ -554,8 +554,8 @@ fn rebuild_tests_if_lib_changes() {
sleep_ms(1000);
File::create(&p.root().join("src/lib.rs")).unwrap();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("test").arg("-v"), execs().with_status(101));
assert_that(p.cargo("build -v"), execs());
assert_that(p.cargo("test -v"), execs().with_status(101));
}
#[test]
@ -609,7 +609,7 @@ fn no_rebuild_transitive_target_deps() {
assert_that(p.cargo("build"), execs());
assert_that(
p.cargo("test").arg("--no-run"),
p.cargo("test --no-run"),
execs().with_stderr(
"\
[COMPILING] c v0.0.1 ([..])

View File

@ -718,7 +718,7 @@ fn two_revs_same_deps() {
)
.build();
assert_that(foo.cargo("build").arg("-v"), execs());
assert_that(foo.cargo("build -v"), execs());
assert_that(&foo.bin("foo"), existing_file());
assert_that(foo.process(&foo.bin("foo")), execs());
}
@ -824,7 +824,7 @@ fn recompilation() {
// Make sure clean only cleans one dep
assert_that(
p.cargo("clean").arg("-p").arg("foo"),
p.cargo("clean -p foo"),
execs().with_stdout(""),
);
assert_that(
@ -938,7 +938,7 @@ fn update_with_shared_deps() {
// By default, not transitive updates
println!("dep1 update");
assert_that(
p.cargo("update").arg("-p").arg("dep1"),
p.cargo("update -p dep1"),
execs().with_stdout(""),
);
@ -976,7 +976,7 @@ Caused by:
// Updating aggressively should, however, update the repo.
println!("dep1 aggressive update");
assert_that(
p.cargo("update").arg("-p").arg("dep1").arg("--aggressive"),
p.cargo("update -p dep1 --aggressive"),
execs().with_stderr(&format!(
"[UPDATING] git repository `{}`\n\
[UPDATING] bar v0.5.0 ([..]) -> #[..]\n\
@ -1003,7 +1003,7 @@ Caused by:
// We should be able to update transitive deps
assert_that(
p.cargo("update").arg("-p").arg("bar"),
p.cargo("update -p bar"),
execs().with_stderr(&format!(
"[UPDATING] git repository `{}`",
git_project.url()
@ -1191,7 +1191,7 @@ fn two_deps_only_update_one() {
git::commit(&repo);
assert_that(
p.cargo("update").arg("-p").arg("dep1"),
p.cargo("update -p dep1"),
execs().with_stderr(&format!(
"[UPDATING] git repository `{}`\n\
[UPDATING] dep1 v0.5.0 ([..]) -> #[..]\n\
@ -1386,7 +1386,7 @@ fn dep_with_changed_submodule() {
// Update the dependency and carry on!
println!("update");
assert_that(
p.cargo("update").arg("-v"),
p.cargo("update -v"),
execs().with_stderr("").with_stderr(&format!(
"[UPDATING] git repository `{}`\n\
[UPDATING] dep1 v0.5.0 ([..]) -> #[..]\n\
@ -1873,7 +1873,7 @@ fn update_ambiguous() {
assert_that(p.cargo("generate-lockfile"), execs());
assert_that(
p.cargo("update").arg("-p").arg("bar"),
p.cargo("update -p bar"),
execs().with_status(101).with_stderr(
"\
[ERROR] There are multiple `bar` packages in your project, and the specification `bar` \
@ -1920,7 +1920,7 @@ fn update_one_dep_in_repo_with_many_deps() {
assert_that(p.cargo("generate-lockfile"), execs());
assert_that(
p.cargo("update").arg("-p").arg("bar"),
p.cargo("update -p bar"),
execs()
.with_stderr(&format!("[UPDATING] git repository `{}`", bar.url())),
);
@ -2092,7 +2092,7 @@ fn update_one_source_updates_all_packages_in_that_git_source() {
git::commit(&repo);
assert_that(
p.cargo("update").arg("-p").arg("dep"),
p.cargo("update -p dep"),
execs(),
);
let mut lockfile = String::new();
@ -2225,7 +2225,7 @@ fn dont_require_submodules_are_checked_out() {
git2::Repository::clone(&url, &dst).unwrap();
assert_that(
git1.cargo("build").arg("-v").cwd(&dst),
git1.cargo("build -v").cwd(&dst),
execs(),
);
}
@ -2279,7 +2279,7 @@ fn doctest_same_name() {
)
.build();
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
}
#[test]
@ -2464,7 +2464,7 @@ fn two_at_rev_instead_of_tag() {
.build();
assert_that(p.cargo("generate-lockfile"), execs());
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -2530,7 +2530,7 @@ fn include_overrides_gitignore() {
println!("build 1: all is new");
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[UPDATING] registry `[..]`
@ -2551,7 +2551,7 @@ fn include_overrides_gitignore() {
println!("build 2: nothing changed; file timestamps reset by build script");
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[FRESH] libc [..]
@ -2567,7 +2567,7 @@ fn include_overrides_gitignore() {
File::create(p.root().join("src").join("not_incl.rs")).unwrap();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[FRESH] libc [..]
@ -2587,7 +2587,7 @@ fn include_overrides_gitignore() {
File::create(p.root().join("src").join("incl.rs")).unwrap();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(
"\
[FRESH] libc [..]

View File

@ -108,7 +108,7 @@ fn multiple_versions() {
.publish();
assert_that(
p.cargo("update").arg("-v"),
p.cargo("update -v"),
execs()
.with_stderr("[UPDATING] bar v0.1.0 -> v0.2.0"),
);

View File

@ -110,7 +110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
.file("Cargo.lock", &old_lockfile)
.build();
assert_that(p.cargo("build").arg("--locked"), execs());
assert_that(p.cargo("build --locked"), execs());
let lock = p.read_lockfile();
for (l, r) in old_lockfile.lines().zip(lock.lines()) {
@ -489,7 +489,7 @@ fn locked_correct_error() {
let p = p.build();
assert_that(
p.cargo("build").arg("--locked"),
p.cargo("build --locked"),
execs().with_status(101).with_stderr(
"\
[UPDATING] registry `[..]`

View File

@ -81,7 +81,7 @@ fn cargo_metadata_warns_on_implicit_version() {
execs().with_stderr("[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems"));
assert_that(
p.cargo("metadata").arg("--format-version").arg("1"),
p.cargo("metadata --format-version 1"),
execs().with_stderr(""),
);
}
@ -738,7 +738,7 @@ fn workspace_metadata_no_deps() {
.build();
assert_that(
p.cargo("metadata").arg("--no-deps"),
p.cargo("metadata --no-deps"),
execs().with_json(
r#"
{
@ -819,7 +819,7 @@ fn cargo_metadata_with_invalid_manifest() {
let p = project().file("Cargo.toml", "").build();
assert_that(
p.cargo("metadata").arg("--format-version").arg("1"),
p.cargo("metadata --format-version 1"),
execs().with_status(101).with_stderr(
"\
[ERROR] failed to parse manifest at `[..]`
@ -949,7 +949,7 @@ fn cargo_metadata_no_deps_cwd() {
.build();
assert_that(
p.cargo("metadata").arg("--no-deps").cwd(p.root()),
p.cargo("metadata --no-deps").cwd(p.root()),
execs().with_json(MANIFEST_OUTPUT),
);
}
@ -996,7 +996,7 @@ fn multiple_features() {
.build();
assert_that(
p.cargo("metadata").arg("--features").arg("a b"),
p.cargo("metadata --features a b"),
execs(),
);
}
@ -1024,7 +1024,7 @@ fn package_metadata() {
.build();
assert_that(
p.cargo("metadata").arg("--no-deps"),
p.cargo("metadata --no-deps"),
execs().with_json(
r#"
{

View File

@ -29,7 +29,7 @@ fn net_retry_loads_from_config() {
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_status(101).with_stderr_contains(
"[WARNING] spurious network error \
(1 tries remaining): [..]",
@ -63,7 +63,7 @@ fn net_retry_git_outputs_warning() {
.build();
assert_that(
p.cargo("build").arg("-v").arg("-j").arg("1"),
p.cargo("build -v -j 1"),
execs()
.with_status(101)
.with_stderr_contains(

View File

@ -708,7 +708,7 @@ fn test_override_dep() {
.build();
assert_that(
p.cargo("test").arg("-p").arg("bar"),
p.cargo("test -p bar"),
execs().with_status(101).with_stderr_contains(
"\
error: There are multiple `bar` packages in your project, and the [..]
@ -807,7 +807,7 @@ fn no_override_self() {
.file("src/lib.rs", "#![no_std] pub extern crate near;")
.build();
assert_that(p.cargo("build").arg("--verbose"), execs());
assert_that(p.cargo("build --verbose"), execs());
}
#[test]
@ -995,7 +995,7 @@ fn override_an_override() {
.file("serde/src/lib.rs", "pub fn serde08_override() {}")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]

View File

@ -46,7 +46,7 @@ See [..]
existing_file(),
);
assert_that(
p.cargo("package").arg("-l"),
p.cargo("package -l"),
execs().with_stdout(
"\
Cargo.toml
@ -315,7 +315,7 @@ fn exclude() {
.build();
assert_that(
p.cargo("package").arg("--no-verify").arg("-v"),
p.cargo("package --no-verify -v"),
execs().with_stdout("").with_stderr(
"\
[WARNING] manifest has no description[..]
@ -362,7 +362,7 @@ See [..]
);
assert_that(
p.cargo("package").arg("-l"),
p.cargo("package -l"),
execs().with_stdout(
"\
Cargo.toml
@ -405,7 +405,7 @@ fn include() {
.build();
assert_that(
p.cargo("package").arg("--no-verify").arg("-v"),
p.cargo("package --no-verify -v"),
execs().with_stderr(
"\
[WARNING] manifest has no description[..]
@ -427,7 +427,7 @@ fn package_lib_with_bin() {
.file("src/lib.rs", "")
.build();
assert_that(p.cargo("package").arg("-v"), execs());
assert_that(p.cargo("package -v"), execs());
}
#[test]
@ -534,7 +534,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
existing_file(),
);
assert_that(
p.cargo("package").arg("-l"),
p.cargo("package -l"),
execs().with_stdout(
"\
Cargo.toml
@ -663,7 +663,7 @@ fn broken_symlink() {
t!(fs::symlink("nowhere", &p.root().join("src/foo.rs")));
assert_that(
p.cargo("package").arg("-v"),
p.cargo("package -v"),
execs().with_status(101).with_stderr_contains(
"\
error: failed to prepare local package for uploading
@ -929,7 +929,7 @@ fn package_two_kinds_of_deps() {
.build();
assert_that(
p.cargo("package").arg("--no-verify"),
p.cargo("package --no-verify"),
execs(),
);
}
@ -955,7 +955,7 @@ fn test_edition() {
.build();
assert_that(
p.cargo("build").arg("-v").masquerade_as_nightly_cargo(),
p.cargo("build -v").masquerade_as_nightly_cargo(),
execs()
// --edition is still in flux and we're not passing -Zunstable-options
// from Cargo so it will probably error. Only partially match the output
@ -985,7 +985,7 @@ fn test_edition_missing() {
.build();
assert_that(
p.cargo("build").arg("-v").masquerade_as_nightly_cargo(),
p.cargo("build -v").masquerade_as_nightly_cargo(),
execs()
// --edition is still in flux and we're not passing -Zunstable-options
// from Cargo so it will probably error. Only partially match the output
@ -1015,7 +1015,7 @@ fn test_edition_malformed() {
.build();
assert_that(
p.cargo("build").arg("-v").masquerade_as_nightly_cargo(),
p.cargo("build -v").masquerade_as_nightly_cargo(),
execs().with_status(101).with_stderr(
"\
error: failed to parse manifest at `[..]`
@ -1047,7 +1047,7 @@ fn test_edition_nightly() {
.build();
assert_that(
p.cargo("build").arg("-v").masquerade_as_nightly_cargo(),
p.cargo("build -v").masquerade_as_nightly_cargo(),
execs().with_status(101).with_stderr(
"\
error: failed to parse manifest at `[..]`
@ -1103,7 +1103,7 @@ See [..]
existing_file(),
);
assert_that(
p.cargo("package").arg("-l").masquerade_as_nightly_cargo(),
p.cargo("package -l").masquerade_as_nightly_cargo(),
execs().with_stdout(
"\
Cargo.lock
@ -1161,7 +1161,7 @@ fn package_lockfile_git_repo() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(
p.cargo("package").arg("-l").masquerade_as_nightly_cargo(),
p.cargo("package -l").masquerade_as_nightly_cargo(),
execs().with_stdout(
"\
Cargo.lock

View File

@ -92,12 +92,12 @@ fn cargo_compile_with_nested_deps_shorthand() {
println!("cleaning");
assert_that(
p.cargo("clean").arg("-v"),
p.cargo("clean -v"),
execs().with_stdout(""),
);
println!("building baz");
assert_that(
p.cargo("build").arg("-p").arg("baz"),
p.cargo("build -p baz"),
execs().with_stderr(&format!(
"[COMPILING] baz v0.5.0 ({}/bar/baz)\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) \
@ -107,7 +107,7 @@ fn cargo_compile_with_nested_deps_shorthand() {
);
println!("building foo");
assert_that(
p.cargo("build").arg("-p").arg("foo"),
p.cargo("build -p foo"),
execs().with_stderr(&format!(
"[COMPILING] bar v0.5.0 ({}/bar)\n\
[COMPILING] foo v0.5.0 ({})\n\
@ -603,7 +603,7 @@ fn override_relative() {
)
.file("src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -690,7 +690,7 @@ fn override_path_dep() {
.file("src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -1082,7 +1082,7 @@ fn thin_lto_works() {
.build();
assert_that(
p.cargo("build").arg("--release").arg("-v"),
p.cargo("build --release -v"),
execs().with_stderr(
"\
[COMPILING] top [..]

View File

@ -244,7 +244,7 @@ fn plugin_integration() {
.file("tests/it_works.rs", "")
.build();
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
}
#[test]
@ -279,7 +279,7 @@ fn doctest_a_plugin() {
.file("bar/src/lib.rs", "pub fn bar() {}")
.build();
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
}
// See #1515
@ -331,7 +331,7 @@ fn native_plugin_dependency_with_custom_ar_linker() {
.build();
assert_that(
bar.cargo("build").arg("--verbose"),
bar.cargo("build --verbose"),
execs().with_status(101).with_stderr_contains(
"\
[COMPILING] foo v0.0.1 ([..])

View File

@ -25,7 +25,7 @@ fn profile_overrides() {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(&format!(
"\
[COMPILING] test v0.0.0 ({url})
@ -64,7 +64,7 @@ fn opt_level_override_0() {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(&format!(
"\
[COMPILING] test v0.0.0 ({url})
@ -100,7 +100,7 @@ fn debug_override_1() {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(&format!(
"\
[COMPILING] test v0.0.0 ({url})
@ -139,7 +139,7 @@ fn check_opt_level_override(profile_level: &str, rustc_level: &str) {
.file("src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v"),
p.cargo("build -v"),
execs().with_stderr(&format!(
"\
[COMPILING] test v0.0.0 ({url})
@ -219,7 +219,7 @@ fn top_level_overrides_deps() {
.file("foo/src/lib.rs", "")
.build();
assert_that(
p.cargo("build").arg("-v").arg("--release"),
p.cargo("build -v --release"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.0 ({url}/foo)

View File

@ -350,7 +350,7 @@ fn can_run_doc_tests() {
.build();
assert_that(
foo.cargo("test").arg("-v").masquerade_as_nightly_cargo(),
foo.cargo("test -v").masquerade_as_nightly_cargo(),
execs().with_stderr_contains(format!(
"\
[DOCTEST] foo

View File

@ -43,11 +43,11 @@ fn build_bin_default_features() {
assert_that(&p.bin("foo"), existing_file());
assert_that(
p.cargo("build").arg("--no-default-features"),
p.cargo("build --no-default-features"),
execs(),
);
assert_that(p.cargo("build").arg("--bin=foo"), execs());
assert_that(p.cargo("build --bin=foo"), execs());
assert_that(&p.bin("foo"), existing_file());
assert_that(
@ -86,7 +86,7 @@ fn build_bin_arg_features() {
.build();
assert_that(
p.cargo("build").arg("--features").arg("a"),
p.cargo("build --features a"),
execs(),
);
assert_that(&p.bin("foo"), existing_file());
@ -130,7 +130,7 @@ fn build_bin_multiple_required_features() {
assert_that(&p.bin("foo_2"), existing_file());
assert_that(
p.cargo("build").arg("--features").arg("c"),
p.cargo("build --features c"),
execs(),
);
@ -138,7 +138,7 @@ fn build_bin_multiple_required_features() {
assert_that(&p.bin("foo_2"), existing_file());
assert_that(
p.cargo("build").arg("--no-default-features"),
p.cargo("build --no-default-features"),
execs(),
);
}
@ -167,7 +167,7 @@ fn build_example_default_features() {
.build();
assert_that(
p.cargo("build").arg("--example=foo"),
p.cargo("build --example=foo"),
execs(),
);
assert_that(&p.bin("examples/foo"), existing_file());
@ -248,7 +248,7 @@ fn build_example_multiple_required_features() {
.build();
assert_that(
p.cargo("build").arg("--example=foo_1"),
p.cargo("build --example=foo_1"),
execs().with_status(101).with_stderr(
"\
error: target `foo_1` in package `foo` requires the features: `b`, `c`
@ -257,7 +257,7 @@ Consider enabling them by passing e.g. `--features=\"b c\"`
),
);
assert_that(
p.cargo("build").arg("--example=foo_2"),
p.cargo("build --example=foo_2"),
execs(),
);
@ -343,7 +343,7 @@ fn test_default_features() {
);
assert_that(
p.cargo("test").arg("--no-default-features"),
p.cargo("test --no-default-features"),
execs()
.with_stderr(
"[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"
@ -352,7 +352,7 @@ fn test_default_features() {
);
assert_that(
p.cargo("test").arg("--test=foo"),
p.cargo("test --test=foo"),
execs()
.with_stderr(
"\
@ -398,7 +398,7 @@ fn test_arg_features() {
.build();
assert_that(
p.cargo("test").arg("--features").arg("a"),
p.cargo("test --features a"),
execs()
.with_stderr(format!(
"\
@ -455,7 +455,7 @@ fn test_multiple_required_features() {
);
assert_that(
p.cargo("test").arg("--features").arg("c"),
p.cargo("test --features c"),
execs()
.with_stderr(format!(
"\
@ -469,7 +469,7 @@ fn test_multiple_required_features() {
);
assert_that(
p.cargo("test").arg("--no-default-features"),
p.cargo("test --no-default-features"),
execs()
.with_stderr(
"[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"
@ -528,14 +528,14 @@ fn bench_default_features() {
);
assert_that(
p.cargo("bench").arg("--no-default-features"),
p.cargo("bench --no-default-features"),
execs()
.with_stderr("[FINISHED] release [optimized] target(s) in [..]".to_string())
.with_stdout(""),
);
assert_that(
p.cargo("bench").arg("--bench=foo"),
p.cargo("bench --bench=foo"),
execs()
.with_stderr(
"\
@ -594,7 +594,7 @@ fn bench_arg_features() {
.build();
assert_that(
p.cargo("bench").arg("--features").arg("a"),
p.cargo("bench --features a"),
execs()
.with_stderr(format!(
"\
@ -673,7 +673,7 @@ fn bench_multiple_required_features() {
);
assert_that(
p.cargo("bench").arg("--features").arg("c"),
p.cargo("bench --features c"),
execs()
.with_stderr(format!(
"\
@ -687,7 +687,7 @@ fn bench_multiple_required_features() {
);
assert_that(
p.cargo("bench").arg("--no-default-features"),
p.cargo("bench --no-default-features"),
execs()
.with_stderr("[FINISHED] release [optimized] target(s) in [..]")
.with_stdout(""),
@ -724,10 +724,10 @@ fn install_default_features() {
assert_that(p.cargo("install --path ."), execs());
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(p.cargo("uninstall").arg("foo"), execs());
assert_that(p.cargo("uninstall foo"), execs());
assert_that(
p.cargo("install --path .").arg("--no-default-features"),
p.cargo("install --path . --no-default-features"),
execs().with_status(101).with_stderr(
"\
[INSTALLING] foo v0.0.1 ([..])
@ -739,11 +739,11 @@ fn install_default_features() {
assert_that(cargo_home(), is_not(has_installed_exe("foo")));
assert_that(
p.cargo("install --path .").arg("--bin=foo"),
p.cargo("install --path . --bin=foo"),
execs(),
);
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(p.cargo("uninstall").arg("foo"), execs());
assert_that(p.cargo("uninstall foo"), execs());
assert_that(
p.cargo("install --path .")
@ -764,11 +764,11 @@ Consider enabling them by passing e.g. `--features=\"a\"`
assert_that(cargo_home(), is_not(has_installed_exe("foo")));
assert_that(
p.cargo("install --path .").arg("--example=foo"),
p.cargo("install --path . --example=foo"),
execs(),
);
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(p.cargo("uninstall").arg("foo"), execs());
assert_that(p.cargo("uninstall foo"), execs());
assert_that(
p.cargo("install --path .")
@ -812,11 +812,11 @@ fn install_arg_features() {
.build();
assert_that(
p.cargo("install").arg("--features").arg("a"),
p.cargo("install --features a"),
execs(),
);
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(p.cargo("uninstall").arg("foo"), execs());
assert_that(p.cargo("uninstall foo"), execs());
}
#[test]
@ -854,18 +854,18 @@ fn install_multiple_required_features() {
assert_that(p.cargo("install --path ."), execs());
assert_that(cargo_home(), is_not(has_installed_exe("foo_1")));
assert_that(cargo_home(), has_installed_exe("foo_2"));
assert_that(p.cargo("uninstall").arg("foo"), execs());
assert_that(p.cargo("uninstall foo"), execs());
assert_that(
p.cargo("install --path .").arg("--features").arg("c"),
p.cargo("install --path . --features c"),
execs(),
);
assert_that(cargo_home(), has_installed_exe("foo_1"));
assert_that(cargo_home(), has_installed_exe("foo_2"));
assert_that(p.cargo("uninstall").arg("foo"), execs());
assert_that(p.cargo("uninstall foo"), execs());
assert_that(
p.cargo("install --path .").arg("--no-default-features"),
p.cargo("install --path . --no-default-features"),
execs().with_status(101).with_stderr(
"\
[INSTALLING] foo v0.0.1 ([..])
@ -940,19 +940,19 @@ fn dep_feature_in_toml() {
assert_that(p.cargo("build"), execs());
// bin
assert_that(p.cargo("build").arg("--bin=foo"), execs());
assert_that(p.cargo("build --bin=foo"), execs());
assert_that(&p.bin("foo"), existing_file());
// example
assert_that(
p.cargo("build").arg("--example=foo"),
p.cargo("build --example=foo"),
execs(),
);
assert_that(&p.bin("examples/foo"), existing_file());
// test
assert_that(
p.cargo("test").arg("--test=foo"),
p.cargo("test --test=foo"),
execs()
.with_stderr(format!(
"\
@ -967,7 +967,7 @@ fn dep_feature_in_toml() {
// bench
if is_nightly() {
assert_that(
p.cargo("bench").arg("--bench=foo"),
p.cargo("bench --bench=foo"),
execs()
.with_stderr(format!(
"\
@ -984,7 +984,7 @@ fn dep_feature_in_toml() {
// install
assert_that(p.cargo("install"), execs());
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(p.cargo("uninstall").arg("foo"), execs());
assert_that(p.cargo("uninstall foo"), execs());
}
#[test]
@ -1050,7 +1050,7 @@ fn dep_feature_in_cmd_line() {
// bin
assert_that(
p.cargo("build").arg("--bin=foo"),
p.cargo("build --bin=foo"),
execs().with_status(101).with_stderr(
"\
error: target `foo` in package `foo` requires the features: `bar/a`
@ -1070,7 +1070,7 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"`
// example
assert_that(
p.cargo("build").arg("--example=foo"),
p.cargo("build --example=foo"),
execs().with_status(101).with_stderr(
"\
error: target `foo` in package `foo` requires the features: `bar/a`
@ -1155,11 +1155,11 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"`
assert_that(cargo_home(), is_not(has_installed_exe("foo")));
assert_that(
p.cargo("install").arg("--features").arg("bar/a"),
p.cargo("install --features bar/a"),
execs(),
);
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(p.cargo("uninstall").arg("foo"), execs());
assert_that(p.cargo("uninstall foo"), execs());
}
#[test]
@ -1279,7 +1279,7 @@ Consider enabling them by passing e.g. `--features=\"a\"`
);
assert_that(
p.cargo("run").arg("--features").arg("a"),
p.cargo("run --features a"),
execs(),
);
}

View File

@ -48,7 +48,7 @@ fn simple_quiet_and_verbose() {
.build();
assert_that(
p.cargo("run").arg("-q").arg("-v"),
p.cargo("run -q -v"),
execs()
.with_status(101)
.with_stderr("[ERROR] cannot set both --verbose and --quiet"),
@ -68,7 +68,7 @@ fn quiet_and_verbose_config() {
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();
assert_that(p.cargo("run").arg("-q"), execs());
assert_that(p.cargo("run -q"), execs());
}
#[test]
@ -86,7 +86,7 @@ fn simple_with_args() {
.build();
assert_that(
p.cargo("run").arg("hello").arg("world"),
p.cargo("run hello world"),
execs(),
);
}
@ -133,7 +133,7 @@ fn exit_code_verbose() {
}
assert_that(
p.cargo("run").arg("-v"),
p.cargo("run -v"),
execs().with_status(2).with_stderr(output),
);
}
@ -206,7 +206,7 @@ fn specify_name() {
.build();
assert_that(
p.cargo("run").arg("--bin").arg("a").arg("-v"),
p.cargo("run --bin a -v"),
execs()
.with_stderr(&format!(
"\
@ -221,7 +221,7 @@ fn specify_name() {
);
assert_that(
p.cargo("run").arg("--bin").arg("b").arg("-v"),
p.cargo("run --bin b -v"),
execs()
.with_stderr(
"\
@ -358,7 +358,7 @@ fn run_example() {
.build();
assert_that(
p.cargo("run").arg("--example").arg("a"),
p.cargo("run --example a"),
execs()
.with_stderr(&format!(
"\
@ -391,7 +391,7 @@ fn run_library_example() {
.build();
assert_that(
p.cargo("run").arg("--example").arg("bar"),
p.cargo("run --example bar"),
execs()
.with_status(101)
.with_stderr("[ERROR] example target `bar` is a library and cannot be executed"),
@ -548,7 +548,7 @@ fn run_bins() {
.build();
assert_that(
p.cargo("run").arg("--bins"),
p.cargo("run --bins"),
execs().with_status(1).with_stderr_contains(
"error: Found argument '--bins' which wasn't expected, or isn't valid in this context",
),
@ -570,14 +570,14 @@ fn run_with_filename() {
.build();
assert_that(
p.cargo("run").arg("--bin").arg("bin.rs"),
p.cargo("run --bin bin.rs"),
execs()
.with_status(101)
.with_stderr("[ERROR] no bin target named `bin.rs`"),
);
assert_that(
p.cargo("run").arg("--bin").arg("a.rs"),
p.cargo("run --bin a.rs"),
execs().with_status(101).with_stderr(
"\
[ERROR] no bin target named `a.rs`
@ -587,14 +587,14 @@ Did you mean `a`?",
);
assert_that(
p.cargo("run").arg("--example").arg("example.rs"),
p.cargo("run --example example.rs"),
execs()
.with_status(101)
.with_stderr("[ERROR] no example target named `example.rs`"),
);
assert_that(
p.cargo("run").arg("--example").arg("a.rs"),
p.cargo("run --example a.rs"),
execs().with_status(101).with_stderr(
"\
[ERROR] no example target named `a.rs`
@ -732,7 +732,7 @@ fast2",
);
assert_that(
p.cargo("run").arg("-v").arg("--example").arg("a"),
p.cargo("run -v --example a"),
execs()
.with_stderr(&format!(
"\
@ -798,7 +798,7 @@ fn run_dylib_dep() {
.build();
assert_that(
p.cargo("run").arg("hello").arg("world"),
p.cargo("run hello world"),
execs(),
);
}
@ -815,7 +815,7 @@ fn release_works() {
.build();
assert_that(
p.cargo("run").arg("--release"),
p.cargo("run --release"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.1 ({dir})
@ -1013,7 +1013,7 @@ fn fail_no_extra_verbose() {
.build();
assert_that(
p.cargo("run").arg("-q"),
p.cargo("run -q"),
execs().with_status(1).with_stdout("").with_stderr(""),
);
}

View File

@ -13,7 +13,7 @@ fn build_lib_for_foo() {
.build();
assert_that(
p.cargo("rustc").arg("--lib").arg("-v"),
p.cargo("rustc --lib -v"),
execs().with_stderr(format!(
"\
[COMPILING] foo v0.0.1 ({url})
@ -264,7 +264,7 @@ fn targets_selected_default() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(
p.cargo("rustc").arg("-v"),
p.cargo("rustc -v"),
execs()
// bin
.with_stderr_contains("\
@ -287,7 +287,7 @@ fn targets_selected_all() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(
p.cargo("rustc").arg("-v").arg("--all-targets"),
p.cargo("rustc -v --all-targets"),
execs()
// bin
.with_stderr_contains("\
@ -389,7 +389,7 @@ fn rustc_with_other_profile() {
.build();
assert_that(
p.cargo("rustc").arg("--profile").arg("test"),
p.cargo("rustc --profile test"),
execs(),
);
}

View File

@ -8,7 +8,7 @@ fn rustdoc_simple() {
.build();
assert_that(
p.cargo("rustdoc").arg("-v"),
p.cargo("rustdoc -v"),
execs().with_stderr(format!(
"\
[DOCUMENTING] foo v0.0.1 ({url})
@ -30,7 +30,7 @@ fn rustdoc_args() {
.build();
assert_that(
p.cargo("rustdoc").arg("-v").arg("--").arg("--cfg=foo"),
p.cargo("rustdoc -v -- --cfg=foo"),
execs().with_stderr(format!(
"\
[DOCUMENTING] foo v0.0.1 ({url})
@ -69,7 +69,7 @@ fn rustdoc_foo_with_bar_dependency() {
.build();
assert_that(
foo.cargo("rustdoc").arg("-v").arg("--").arg("--cfg=foo"),
foo.cargo("rustdoc -v -- --cfg=foo"),
execs().with_stderr(format!(
"\
[CHECKING] bar v0.0.1 ([..])
@ -139,7 +139,7 @@ fn rustdoc_same_name_documents_lib() {
.build();
assert_that(
p.cargo("rustdoc").arg("-v").arg("--").arg("--cfg=foo"),
p.cargo("rustdoc -v -- --cfg=foo"),
execs().with_stderr(format!(
"\
[DOCUMENTING] foo v0.0.1 ([..])

View File

@ -28,7 +28,7 @@ fn parses_config() {
.build();
assert_that(
p.cargo("doc").arg("-v"),
p.cargo("doc -v"),
execs()
.with_stderr_contains("[RUNNING] `rustdoc [..] --cfg foo[..]`"),
);

View File

@ -483,10 +483,10 @@ fn build_rustflags_normal_source() {
)
.build();
assert_that(p.cargo("build").arg("--lib"), execs().with_status(101));
assert_that(p.cargo("build").arg("--bin=a"), execs().with_status(101));
assert_that(p.cargo("build --lib"), execs().with_status(101));
assert_that(p.cargo("build --bin=a"), execs().with_status(101));
assert_that(
p.cargo("build").arg("--example=b"),
p.cargo("build --example=b"),
execs().with_status(101),
);
assert_that(p.cargo("test"), execs().with_status(101));
@ -682,11 +682,11 @@ fn build_rustflags_normal_source_with_target() {
// Use RUSTFLAGS to pass an argument that will generate an error
assert_that(
p.cargo("build").arg("--lib").arg("--target").arg(host),
p.cargo("build --lib --target").arg(host),
execs().with_status(101),
);
assert_that(
p.cargo("build").arg("--bin=a").arg("--target").arg(host),
p.cargo("build --bin=a --target").arg(host),
execs().with_status(101),
);
assert_that(
@ -697,11 +697,11 @@ fn build_rustflags_normal_source_with_target() {
execs().with_status(101),
);
assert_that(
p.cargo("test").arg("--target").arg(host),
p.cargo("test --target").arg(host),
execs().with_status(101),
);
assert_that(
p.cargo("bench").arg("--target").arg(host),
p.cargo("bench --target").arg(host),
execs().with_status(101),
);
}
@ -741,7 +741,7 @@ fn build_rustflags_build_script_with_target() {
let host = rustc_host();
assert_that(
p.cargo("build").arg("--target").arg(host),
p.cargo("build --target").arg(host),
execs(),
);
}
@ -788,7 +788,7 @@ fn build_rustflags_build_script_dep_with_target() {
let host = rustc_host();
assert_that(
foo.cargo("build").arg("--target").arg(host),
foo.cargo("build --target").arg(host),
execs(),
);
}
@ -830,7 +830,7 @@ fn build_rustflags_plugin_with_target() {
let host = rustc_host();
assert_that(
p.cargo("build").arg("--target").arg(host),
p.cargo("build --target").arg(host),
execs(),
);
}
@ -879,7 +879,7 @@ fn build_rustflags_plugin_dep_with_target() {
let host = rustc_host();
assert_that(
foo.cargo("build").arg("--target").arg(host),
foo.cargo("build --target").arg(host),
execs(),
);
}
@ -974,7 +974,7 @@ fn build_rustflags_with_home_config() {
.file("src/lib.rs", "")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
}
#[test]
@ -1003,10 +1003,10 @@ fn target_rustflags_normal_source() {
)
.build();
assert_that(p.cargo("build").arg("--lib"), execs().with_status(101));
assert_that(p.cargo("build").arg("--bin=a"), execs().with_status(101));
assert_that(p.cargo("build --lib"), execs().with_status(101));
assert_that(p.cargo("build --bin=a"), execs().with_status(101));
assert_that(
p.cargo("build").arg("--example=b"),
p.cargo("build --example=b"),
execs().with_status(101),
);
assert_that(p.cargo("test"), execs().with_status(101));
@ -1033,10 +1033,10 @@ fn target_rustflags_precedence() {
)
.build();
assert_that(p.cargo("build").arg("--lib"), execs().with_status(101));
assert_that(p.cargo("build").arg("--bin=a"), execs().with_status(101));
assert_that(p.cargo("build --lib"), execs().with_status(101));
assert_that(p.cargo("build --bin=a"), execs().with_status(101));
assert_that(
p.cargo("build").arg("--example=b"),
p.cargo("build --example=b"),
execs().with_status(101),
);
assert_that(p.cargo("test"), execs().with_status(101));
@ -1067,7 +1067,7 @@ fn cfg_rustflags_normal_source() {
.build();
assert_that(
p.cargo("build").arg("--lib").arg("-v"),
p.cargo("build --lib -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1078,7 +1078,7 @@ fn cfg_rustflags_normal_source() {
);
assert_that(
p.cargo("build").arg("--bin=a").arg("-v"),
p.cargo("build --bin=a -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1089,7 +1089,7 @@ fn cfg_rustflags_normal_source() {
);
assert_that(
p.cargo("build").arg("--example=b").arg("-v"),
p.cargo("build --example=b -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1100,7 +1100,7 @@ fn cfg_rustflags_normal_source() {
);
assert_that(
p.cargo("test").arg("--no-run").arg("-v"),
p.cargo("test --no-run -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1113,7 +1113,7 @@ fn cfg_rustflags_normal_source() {
);
assert_that(
p.cargo("bench").arg("--no-run").arg("-v"),
p.cargo("bench --no-run -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1154,7 +1154,7 @@ fn cfg_rustflags_precedence() {
.build();
assert_that(
p.cargo("build").arg("--lib").arg("-v"),
p.cargo("build --lib -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1165,7 +1165,7 @@ fn cfg_rustflags_precedence() {
);
assert_that(
p.cargo("build").arg("--bin=a").arg("-v"),
p.cargo("build --bin=a -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1176,7 +1176,7 @@ fn cfg_rustflags_precedence() {
);
assert_that(
p.cargo("build").arg("--example=b").arg("-v"),
p.cargo("build --example=b -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1187,7 +1187,7 @@ fn cfg_rustflags_precedence() {
);
assert_that(
p.cargo("test").arg("--no-run").arg("-v"),
p.cargo("test --no-run -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1200,7 +1200,7 @@ fn cfg_rustflags_precedence() {
);
assert_that(
p.cargo("bench").arg("--no-run").arg("-v"),
p.cargo("bench --no-run -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1227,7 +1227,7 @@ fn target_rustflags_string_and_array_form1() {
.build();
assert_that(
p1.cargo("build").arg("-v"),
p1.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1249,7 +1249,7 @@ fn target_rustflags_string_and_array_form1() {
.build();
assert_that(
p2.cargo("build").arg("-v"),
p2.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1277,7 +1277,7 @@ fn target_rustflags_string_and_array_form2() {
.build();
assert_that(
p1.cargo("build").arg("-v"),
p1.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -1302,7 +1302,7 @@ fn target_rustflags_string_and_array_form2() {
.build();
assert_that(
p2.cargo("build").arg("-v"),
p2.cargo("build -v"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])

View File

@ -93,7 +93,7 @@ fn cargo_test_release() {
.build();
assert_that(
p.cargo("test").arg("-v").arg("--release"),
p.cargo("test -v --release"),
execs()
.with_stderr(format!(
"\
@ -149,7 +149,7 @@ fn cargo_test_overflow_checks() {
)
.build();
assert_that(p.cargo("build").arg("--release"), execs());
assert_that(p.cargo("build --release"), execs());
assert_that(&p.release_bin("foo"), existing_file());
assert_that(
@ -172,7 +172,7 @@ fn cargo_test_verbose() {
.build();
assert_that(
p.cargo("test").arg("-v").arg("hello"),
p.cargo("test -v hello"),
execs()
.with_stderr(format!(
"\
@ -213,7 +213,7 @@ fn many_similar_names() {
)
.build();
let output = p.cargo("test").arg("-v").exec_with_output().unwrap();
let output = p.cargo("test -v").exec_with_output().unwrap();
let output = str::from_utf8(&output.stdout).unwrap();
assert!(
output.contains("test bin_test"),
@ -648,7 +648,7 @@ fn pass_through_command_line() {
.build();
assert_that(
p.cargo("test").arg("bar"),
p.cargo("test bar"),
execs()
.with_stderr(&format!(
"\
@ -663,7 +663,7 @@ fn pass_through_command_line() {
);
assert_that(
p.cargo("test").arg("foo"),
p.cargo("test foo"),
execs()
.with_stderr(
"\
@ -1120,7 +1120,7 @@ fn bin_there_for_integration() {
)
.build();
let output = p.cargo("test").arg("-v").exec_with_output().unwrap();
let output = p.cargo("test -v").exec_with_output().unwrap();
let output = str::from_utf8(&output.stdout).unwrap();
assert!(
output.contains("main_test ... ok"),
@ -1295,7 +1295,7 @@ fn test_no_run() {
.build();
assert_that(
p.cargo("test").arg("--no-run"),
p.cargo("test --no-run"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.1 ({dir})
@ -1331,7 +1331,7 @@ fn test_run_specific_bin_target() {
.build();
assert_that(
prj.cargo("test").arg("--bin").arg("bin2"),
prj.cargo("test --bin bin2"),
execs()
.with_stderr(format!(
"\
@ -1375,7 +1375,7 @@ fn test_run_implicit_bin_target() {
.build();
assert_that(
prj.cargo("test").arg("--bins"),
prj.cargo("test --bins"),
execs()
.with_stderr(format!(
"\
@ -1398,7 +1398,7 @@ fn test_run_specific_test_target() {
.build();
assert_that(
prj.cargo("test").arg("--test").arg("b"),
prj.cargo("test --test b"),
execs()
.with_stderr(format!(
"\
@ -1441,7 +1441,7 @@ fn test_run_implicit_test_target() {
.build();
assert_that(
prj.cargo("test").arg("--tests"),
prj.cargo("test --tests"),
execs()
.with_stderr(format!(
"\
@ -1485,7 +1485,7 @@ fn test_run_implicit_bench_target() {
.build();
assert_that(
prj.cargo("test").arg("--benches"),
prj.cargo("test --benches"),
execs()
.with_stderr(format!(
"\
@ -1609,7 +1609,7 @@ fn test_no_harness() {
.build();
assert_that(
p.cargo("test").arg("--").arg("--nocapture"),
p.cargo("test -- --nocapture"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.1 ({dir})
@ -1683,7 +1683,7 @@ fn selective_testing() {
println!("d1");
assert_that(
p.cargo("test").arg("-p").arg("d1"),
p.cargo("test -p d1"),
execs()
.with_stderr(&format!(
"\
@ -1698,7 +1698,7 @@ fn selective_testing() {
println!("d2");
assert_that(
p.cargo("test").arg("-p").arg("d2"),
p.cargo("test -p d2"),
execs()
.with_stderr(&format!(
"\
@ -1809,7 +1809,7 @@ fn build_then_selective_test() {
assert_that(p.cargo("build"), execs());
p.root().move_into_the_past();
assert_that(p.cargo("test").arg("-p").arg("b"), execs());
assert_that(p.cargo("test -p b"), execs());
}
#[test]
@ -1901,7 +1901,7 @@ fn selective_testing_with_docs() {
let p = p.build();
assert_that(
p.cargo("test").arg("-p").arg("d1"),
p.cargo("test -p d1"),
execs()
.with_stderr(&format!(
"\
@ -1923,7 +1923,7 @@ fn example_bin_same_name() {
.build();
assert_that(
p.cargo("test").arg("--no-run").arg("-v"),
p.cargo("test --no-run -v"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.0.1 ({dir})
@ -1965,10 +1965,10 @@ fn test_with_example_twice() {
.build();
println!("first");
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
assert_that(&p.bin("examples/foo"), existing_file());
println!("second");
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
assert_that(&p.bin("examples/foo"), existing_file());
}
@ -2002,7 +2002,7 @@ fn example_with_dev_dep() {
.build();
assert_that(
p.cargo("test").arg("-v"),
p.cargo("test -v"),
execs().with_stderr(
"\
[..]
@ -2023,11 +2023,11 @@ fn bin_is_preserved() {
.file("src/main.rs", "fn main() {}")
.build();
assert_that(p.cargo("build").arg("-v"), execs());
assert_that(p.cargo("build -v"), execs());
assert_that(&p.bin("foo"), existing_file());
println!("testing");
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
assert_that(&p.bin("foo"), existing_file());
}
@ -2038,13 +2038,13 @@ fn bad_example() {
let p = p.build();
assert_that(
p.cargo("run").arg("--example").arg("foo"),
p.cargo("run --example foo"),
execs()
.with_status(101)
.with_stderr("[ERROR] no example target named `foo`"),
);
assert_that(
p.cargo("run").arg("--bin").arg("foo"),
p.cargo("run --bin foo"),
execs()
.with_status(101)
.with_stderr("[ERROR] no bin target named `foo`"),
@ -2078,7 +2078,7 @@ fn doctest_feature() {
.build();
assert_that(
p.cargo("test").arg("--features").arg("bar"),
p.cargo("test --features bar"),
execs()
.with_stderr(
"\
@ -2107,7 +2107,7 @@ fn dashes_to_underscores() {
)
.build();
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
}
#[test]
@ -2138,7 +2138,7 @@ fn doctest_dev_dep() {
.file("b/src/lib.rs", "")
.build();
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
}
#[test]
@ -2157,7 +2157,7 @@ fn filter_no_doc_tests() {
.build();
assert_that(
p.cargo("test").arg("--test=foo"),
p.cargo("test --test=foo"),
execs()
.with_stderr(
"\
@ -2384,7 +2384,7 @@ fn no_fail_fast() {
)
.build();
assert_that(
p.cargo("test").arg("--no-fail-fast"),
p.cargo("test --no-fail-fast"),
execs()
.with_status(101)
.with_stderr_contains(
@ -2459,7 +2459,7 @@ fn test_multiple_packages() {
let p = p.build();
assert_that(
p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"),
p.cargo("test -p d1 -p d2"),
execs()
.with_stderr_contains("[RUNNING] target/debug/deps/d1-[..][EXE]")
.with_stderr_contains("[RUNNING] target/debug/deps/d2-[..][EXE]")
@ -2475,7 +2475,7 @@ fn bin_does_not_rebuild_tests() {
.file("tests/foo.rs", "");
let p = p.build();
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
sleep_ms(1000);
File::create(&p.root().join("src/main.rs"))
@ -2484,7 +2484,7 @@ fn bin_does_not_rebuild_tests() {
.unwrap();
assert_that(
p.cargo("test").arg("-v").arg("--no-run"),
p.cargo("test -v --no-run"),
execs().with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -2587,7 +2587,7 @@ fn only_test_docs() {
let p = p.build();
assert_that(
p.cargo("test").arg("--doc"),
p.cargo("test --doc"),
execs()
.with_stderr(
"\
@ -2629,7 +2629,7 @@ fn test_panic_abort_with_dep() {
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
.file("bar/src/lib.rs", "")
.build();
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
}
#[test]
@ -2651,7 +2651,7 @@ fn cfg_test_even_with_no_harness() {
.file("src/lib.rs", r#"#[cfg(test)] fn main() { println!("hello!"); }"#)
.build();
assert_that(
p.cargo("test").arg("-v"),
p.cargo("test -v"),
execs().with_stdout("hello!\n").with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@ -2778,7 +2778,7 @@ fn pass_correct_cfgs_flags_to_rustdoc() {
);
assert_that(
p.cargo("test").arg("--verbose"),
p.cargo("test --verbose"),
execs().with_stderr_contains(
"\
[DOCTEST] foo
@ -2815,9 +2815,9 @@ fn test_release_ignore_panic() {
.file("a/src/lib.rs", "");
let p = p.build();
println!("test");
assert_that(p.cargo("test").arg("-v"), execs());
assert_that(p.cargo("test -v"), execs());
println!("bench");
assert_that(p.cargo("bench").arg("-v"), execs());
assert_that(p.cargo("bench -v"), execs());
}
#[test]
@ -2873,7 +2873,7 @@ fn test_all_workspace() {
.build();
assert_that(
p.cargo("test").arg("--all"),
p.cargo("test --all"),
execs()
.with_stdout_contains("test foo_test ... ok")
.with_stdout_contains("test bar_test ... ok"),
@ -2902,7 +2902,7 @@ fn test_all_exclude() {
.build();
assert_that(
p.cargo("test").arg("--all").arg("--exclude").arg("baz"),
p.cargo("test --all --exclude baz"),
execs().with_stdout_contains(
"running 1 test
test bar ... ok",
@ -2927,7 +2927,7 @@ fn test_all_virtual_manifest() {
.build();
assert_that(
p.cargo("test").arg("--all"),
p.cargo("test --all"),
execs()
.with_stdout_contains("test a ... ok")
.with_stdout_contains("test b ... ok"),
@ -2985,7 +2985,7 @@ fn test_all_member_dependency_same_name() {
Package::new("a", "0.1.0").publish();
assert_that(
p.cargo("test").arg("--all"),
p.cargo("test --all"),
execs().with_stdout_contains("test a ... ok"),
);
}
@ -3020,7 +3020,7 @@ fn doctest_only_with_dev_dep() {
.build();
assert_that(
p.cargo("test").arg("--doc").arg("-v"),
p.cargo("test --doc -v"),
execs(),
);
}
@ -3139,7 +3139,7 @@ fn doctest_and_registry() {
Package::new("b", "0.1.0").publish();
assert_that(
p.cargo("test").arg("--all").arg("-v"),
p.cargo("test --all -v"),
execs(),
);
}
@ -3186,7 +3186,7 @@ fn test_order() {
.build();
assert_that(
p.cargo("test").arg("--all"),
p.cargo("test --all"),
execs().with_stdout_contains(
"
running 1 test
@ -3228,7 +3228,7 @@ fn cyclic_dev() {
.file("tests/foo.rs", "extern crate foo;")
.build();
assert_that(p.cargo("test").arg("--all"), execs());
assert_that(p.cargo("test --all"), execs());
}
#[test]
@ -3270,7 +3270,7 @@ fn publish_a_crate_without_tests() {
assert_that(p.cargo("test"), execs());
assert_that(
p.cargo("test").arg("--package").arg("testless"),
p.cargo("test --package testless"),
execs(),
);
}
@ -3374,7 +3374,7 @@ fn test_hint_not_masked_by_doctest() {
)
.build();
assert_that(
p.cargo("test").arg("--no-fail-fast"),
p.cargo("test --no-fail-fast"),
execs()
.with_status(101)
.with_stdout_contains("test this_fails ... FAILED")

View File

@ -23,7 +23,7 @@ fn pathless_tools() {
.build();
assert_that(
foo.cargo("build").arg("--verbose"),
foo.cargo("build --verbose"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.5.0 ({url})
@ -77,7 +77,7 @@ fn absolute_tools() {
};
assert_that(
foo.cargo("build").arg("--verbose"),
foo.cargo("build --verbose"),
execs().with_stderr(&format!(
"\
[COMPILING] foo v0.5.0 ({url})

View File

@ -110,7 +110,7 @@ fn transitive_minor_update() {
// Also note that this is probably counterintuitive and weird. We may wish
// to change this one day.
assert_that(
p.cargo("update").arg("-p").arg("serde"),
p.cargo("update -p serde"),
execs().with_stderr(
"\
[UPDATING] registry `[..]`
@ -161,7 +161,7 @@ fn conservative() {
Package::new("serde", "0.1.1").dep("log", "0.1").publish();
assert_that(
p.cargo("update").arg("-p").arg("serde"),
p.cargo("update -p serde"),
execs().with_stderr(
"\
[UPDATING] registry `[..]`

View File

@ -999,7 +999,7 @@ fn new_warns_you_this_will_not_work() {
let p = p.build();
assert_that(
p.cargo("new").arg("--lib").arg("bar").env("USER", "foo"),
p.cargo("new --lib bar").env("USER", "foo"),
execs().with_stderr(
"\
warning: compiling this new crate may not work due to invalid workspace \
@ -1867,7 +1867,7 @@ fn dep_used_with_separate_features() {
// Build the entire workspace
assert_that(
p.cargo("build").arg("--all"),
p.cargo("build --all"),
execs().with_stderr(
"\
[..]Compiling feat_lib v0.1.0 ([..])
@ -2015,7 +2015,7 @@ fn cargo_home_at_root_works() {
assert_that(p.cargo("build"), execs());
assert_that(
p.cargo("build").arg("--frozen").env("CARGO_HOME", p.root()),
p.cargo("build --frozen").env("CARGO_HOME", p.root()),
execs(),
);
}