From f18f3559e2e23484f764629943e892b508d06b37 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 6 Dec 2021 14:56:45 -0600 Subject: [PATCH 1/2] docs: Fix example test code --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9330022032..71a54f5160a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,7 @@ you can set `App::help_heading`. Example test: ```rust -fn app() -> clap::App { +fn app() -> clap::App<'static> { ... } From 7dfd1f2e6b7a709a5017ab8c028ba7ad1ac3ebc7 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 6 Dec 2021 14:58:56 -0600 Subject: [PATCH 2/2] docs: Encourage CLI testing --- CHANGELOG.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a54f5160a..11627e7310e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,14 +38,15 @@ you can set `App::help_heading`. **From clap v2** -1. Update your dependency +1. Add CLI tests, `-h` and `--help` output at a minimum (recommendation: [trycmd](https://docs.rs/trycmd/) for snapshot testing) +2. Update your dependency 1. *If you use `no-default-features`:* add the `std` feature -2. Resolve compiler errors -3. Resolve behavior changes +3. Resolve compiler errors +4. Resolve behavior changes 1. Refactor your `App` creation to a function and add a test similar to the one below, resolving any of its assertions 2. Look over the "subtle changes" under BREAKING CHANGES 3. *If using builder:* test your application under various circumstances to see if `ArgMatches` asserts regarding `AllowInvalidUtf8`. -4. *At your leisure:* resolve deprecation notices +5. *At your leisure:* resolve deprecation notices Example test: ```rust @@ -61,14 +62,15 @@ fn verify_app() { **From structopt 0.3.25** -1. Update your dependency, adding the `derive` feature flag +1. Add CLI tests, `-h` and `--help` output at a minimum (recommendation: [trycmd](https://docs.rs/trycmd/) for snapshot testing) +2. Update your dependency, adding the `derive` feature flag 1. *If you use `no-default-features`:* add the `std` feature -2. Resolve compiler errors, including +3. Resolve compiler errors, including 1. Update your `use` statements from `structopt` and `structopt::clap` to `clap` -3. Resolve behavior changes +4. Resolve behavior changes 1. Add a test similar to the one below, resolving any of its assertions 2. Look over the "subtle changes" under BREAKING CHANGES -4. *At your leisure:* resolve deprecation notices +5. *At your leisure:* resolve deprecation notices Example test: ```rust @@ -86,19 +88,20 @@ fn verify_app() { **From clap v3.0.0-beta.5** -1. Update your dependency +1. Add CLI tests, `-h` and `--help` output at a minimum (recommendation: [trycmd](https://docs.rs/trycmd/) for snapshot testing) +2. Update your dependency 1. Add in `derive`, `env`, `cargo`, or `unicode` feature flags as needed -2. Resolve compiler errors +3. Resolve compiler errors 2. *If you use `yaml`, `clap_app!`, or usage parser:* revert any changes you made for clap3 2. Change `Arg::about` `Arg::long_about` back to `help` and `long_help` and change `PossibleValue::about` to `help` ([clap-rs/clap#2937](https://github.com/clap-rs/clap/discussions/2937)) 3. Change `AppSettings::HelpRequired` to `AppSettings::HelpExpected` 4. Change `PossibleValue::hidden` to `PossibleValue::hide` 5. Change `App::subcommand_placeholder` to `App::subcommand_value_name` / `App::subcommand_help_heading` -3. Resolve behavior changes +4. Resolve behavior changes 2. Add the above listed test appropriate for your application and resolve any problems it reports 1. *If using `derive`:* see the structopt breaking changes section for `Vec` changes 3. *If using builder:* test your application under various circumstances to see if `ArgMatches` asserts regarding `AllowInvalidUtf8`. -4. *At your leisure:* resolve deprecation notices +5. *At your leisure:* resolve deprecation notices ### BREAKING CHANGES