Skip to content

Commit 70d80fc

Browse files
committed
test(mangen): Add test for flatten_help
This test shows that the output stays the same independent of the value of `flatten_help`. Further commits may implement `flatten_help` for `clap_mangen`. Signed-off-by: Paul Spooren <mail@aparcar.org>
1 parent 61f5ee5 commit 70d80fc

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.ie \n(.g .ds Aq \(aq
2+
.el .ds Aq '
3+
.TH my-app 1 "my-app "
4+
.SH NAME
5+
my\-app
6+
.SH SYNOPSIS
7+
\fBmy\-app\fR [\fB\-c \fR] [\fB\-v \fR] [\fB\-h\fR|\fB\-\-help\fR] [\fIsubcommands\fR]
8+
.SH DESCRIPTION
9+
.SH OPTIONS
10+
.TP
11+
\fB\-c\fR
12+
13+
.TP
14+
\fB\-v\fR
15+
16+
.TP
17+
\fB\-h\fR, \fB\-\-help\fR
18+
Print help
19+
.SH SUBCOMMANDS
20+
.TP
21+
my\-app\-test(1)
22+
Subcommand
23+
with a second line
24+
.TP
25+
my\-app\-help(1)
26+
Print this message or the help of the given subcommand(s)

clap_mangen/tests/testsuite/roff.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,17 @@ fn value_name_without_arg() {
105105
cmd,
106106
);
107107
}
108+
109+
#[test]
110+
fn flatten_help_false() {
111+
let name = "my-app";
112+
let cmd = common::basic_command(name).flatten_help(false);
113+
common::assert_matches(snapbox::file!["../snapshots/basic.bash.roff"], cmd);
114+
}
115+
116+
#[test]
117+
fn flatten_help_true() {
118+
let name = "my-app";
119+
let cmd = common::basic_command(name).flatten_help(true);
120+
common::assert_matches(snapbox::file!["../snapshots/flatten_help.roff"], cmd);
121+
}

0 commit comments

Comments
 (0)