From 7426569c4dc2943cb9f68d48c3aab92515d11149 Mon Sep 17 00:00:00 2001 From: kraktus Date: Wed, 4 May 2022 19:08:21 +0200 Subject: [PATCH 01/22] test CLI output with `trycmd` Important before moving from `StructOpt` to `clap` --- Cargo.toml | 1 + tests/cli_tests.rs | 4 ++ tests/cmd/h.stderr | 0 tests/cmd/h.stdout | 48 ++++++++++++++++++++++ tests/cmd/h.sterr | 0 tests/cmd/h.toml | 2 + tests/cmd/help.stderr | 0 tests/cmd/help.stdout | 94 +++++++++++++++++++++++++++++++++++++++++++ tests/cmd/help.toml | 2 + 9 files changed, 151 insertions(+) create mode 100644 tests/cli_tests.rs create mode 100644 tests/cmd/h.stderr create mode 100644 tests/cmd/h.stdout create mode 100644 tests/cmd/h.sterr create mode 100644 tests/cmd/h.toml create mode 100644 tests/cmd/help.stderr create mode 100644 tests/cmd/help.stdout create mode 100644 tests/cmd/help.toml diff --git a/Cargo.toml b/Cargo.toml index a7b4a6c..ad98224 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,3 +34,4 @@ colored = "2" [dev-dependencies] quickcheck = "0.9.2" +trycmd = "0.13.4" diff --git a/tests/cli_tests.rs b/tests/cli_tests.rs new file mode 100644 index 0000000..edecca6 --- /dev/null +++ b/tests/cli_tests.rs @@ -0,0 +1,4 @@ +#[test] +fn cli_tests() { + trycmd::TestCases::new().case("tests/cmd/*.toml"); +} diff --git a/tests/cmd/h.stderr b/tests/cmd/h.stderr new file mode 100644 index 0000000..e69de29 diff --git a/tests/cmd/h.stdout b/tests/cmd/h.stdout new file mode 100644 index 0000000..a9fb4a6 --- /dev/null +++ b/tests/cmd/h.stdout @@ -0,0 +1,48 @@ +cargo-bisect-rustc 0.6.3 + +USAGE: + cargo-bisect-rustc [FLAGS] [OPTIONS] [-- ...] + +FLAGS: + -a, --alt Download the alt build instead of normal build + --by-commit Bisect via commit artifacts + --force-install Force installation over existing artifacts + -h, --help Prints help information + --preserve Preserve the downloaded artifacts + --preserve-target Preserve the target directory used for builds + --prompt Manually evaluate for regression with prompts + -V, --version Prints version information + --verbose + --with-dev Download rustc-dev [default: no download] + --with-src Download rust-src [default: no download] + --without-cargo Do not install cargo [default: install cargo] + +OPTIONS: + --access How to access Rust git repository [github|checkout] + -c, --component ... additional components to install + --end Right bound for search (*with* regression). You can use a date (YYYY-MM-DD), git + tag name (e.g. 1.58.0) or git commit SHA. + --host Host triple for the compiler [default: unknown] + --install Install the given artifact + --regress Custom regression definition [default: error] + --script