Skip to content

Commit

Permalink
test(derive): Show derive bug
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Oct 3, 2022
1 parent ee16d78 commit 39b1ef0
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/derive/doc_comments_help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use crate::utils;

use clap::{CommandFactory, Parser, ValueEnum};
use clap::{CommandFactory, Parser, Subcommand, ValueEnum};

#[test]
fn doc_comments() {
Expand Down Expand Up @@ -248,3 +248,31 @@ fn doc_comment_about_handles_both_abouts() {
// comment.
assert_eq!(cmd.get_long_about(), None);
}

#[test]
fn respect_subcommand_doc_comment() {
#[derive(Parser, Debug)]
pub enum Cmd {
/// For child
#[command(subcommand)]
Child(Child),
}

#[derive(Subcommand, Debug)]
pub enum Child {
One,
Twp,
}

const OUTPUT: &str = "\
Usage: cmd <COMMAND>
Commands:
child
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help information
";
utils::assert_output::<Cmd>("cmd --help", OUTPUT, false);
}

0 comments on commit 39b1ef0

Please sign in to comment.