Auto merge of #1890 - Smittyvb:cargo-miri-short-alias, r=RalfJung

One character aliases for cargo-miri run/test

The main `cargo` command supports `cargo r` as an alias for `cargo run`, and `cargo t` as an alias for `cargo test`. This adds support to them in `cargo-miri` for consistency.
This commit is contained in:
bors 2021-09-14 18:17:44 +00:00
commit 6cf851f6d4
2 changed files with 8 additions and 8 deletions

View File

@ -20,8 +20,8 @@ Usage:
cargo miri [subcommand] [<cargo options>...] [--] [<program/test suite options>...] cargo miri [subcommand] [<cargo options>...] [--] [<program/test suite options>...]
Subcommands: Subcommands:
run Run binaries run, r Run binaries
test Run tests test, t Run tests
setup Only perform automatic setup, but without asking questions (for getting a proper libstd) setup Only perform automatic setup, but without asking questions (for getting a proper libstd)
The cargo options are exactly the same as for `cargo run` and `cargo test`, respectively. The cargo options are exactly the same as for `cargo run` and `cargo test`, respectively.
@ -524,8 +524,8 @@ fn phase_cargo_miri(mut args: env::Args) {
// We cannot know which of those flags take arguments and which do not, // We cannot know which of those flags take arguments and which do not,
// so we cannot detect subcommands later. // so we cannot detect subcommands later.
let subcommand = match args.next().as_deref() { let subcommand = match args.next().as_deref() {
Some("test") => MiriCommand::Test, Some("test" | "t") => MiriCommand::Test,
Some("run") => MiriCommand::Run, Some("run" | "r") => MiriCommand::Run,
Some("setup") => MiriCommand::Setup, Some("setup") => MiriCommand::Setup,
// Invalid command. // Invalid command.
_ => _ =>

View File

@ -97,8 +97,8 @@ def test_cargo_miri_run():
cargo_miri("run") + ["--bin", "cargo-miri-test", "--", "hello world", '"hello world"'], cargo_miri("run") + ["--bin", "cargo-miri-test", "--", "hello world", '"hello world"'],
"run.args.stdout.ref", "run.args.stderr.ref", "run.args.stdout.ref", "run.args.stderr.ref",
) )
test("`cargo miri run` (subcrate, no ioslation)", test("`cargo miri r` (subcrate, no isolation)",
cargo_miri("run") + ["-p", "subcrate"], cargo_miri("r") + ["-p", "subcrate"],
"run.subcrate.stdout.ref", "run.subcrate.stderr.ref", "run.subcrate.stdout.ref", "run.subcrate.stderr.ref",
env={'MIRIFLAGS': "-Zmiri-disable-isolation"}, env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
) )
@ -141,8 +141,8 @@ def test_cargo_miri_test():
cargo_miri("test") + ["--bin", "cargo-miri-test", "--", "--format=pretty"], cargo_miri("test") + ["--bin", "cargo-miri-test", "--", "--format=pretty"],
"test.bin-target.stdout.ref", "test.stderr-empty.ref", "test.bin-target.stdout.ref", "test.stderr-empty.ref",
) )
test("`cargo miri test` (subcrate, no isolation)", test("`cargo miri t` (subcrate, no isolation)",
cargo_miri("test") + ["-p", "subcrate"], cargo_miri("t") + ["-p", "subcrate"],
"test.subcrate.stdout.ref", "test.stderr-proc-macro.ref", "test.subcrate.stdout.ref", "test.stderr-proc-macro.ref",
env={'MIRIFLAGS': "-Zmiri-disable-isolation"}, env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
) )