Skip to content

Commit 4395c31

Browse files
shannmuepage
authored andcommitted
test(clap_complete): Add test case for hiding possible values
1 parent 93f0c48 commit 4395c31

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

clap_complete/tests/testsuite/dynamic.rs

+25
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,31 @@ hello-world-foo"
122122
);
123123
}
124124

125+
#[test]
126+
fn suggest_hidden_possible_value() {
127+
let mut cmd = Command::new("exhaustive").arg(
128+
clap::Arg::new("possible_value").long("test").value_parser([
129+
PossibleValue::new("test-visible").help("Say hello to the world"),
130+
PossibleValue::new("test-hidden")
131+
.help("Say hello to the moon")
132+
.hide(true),
133+
]),
134+
);
135+
136+
assert_data_eq!(
137+
complete!(cmd, "--test=test"),
138+
snapbox::str![
139+
"--test=test-visible\tSay hello to the world
140+
--test=test-hidden\tSay hello to the moon"
141+
]
142+
);
143+
144+
assert_data_eq!(
145+
complete!(cmd, "--test=test-h"),
146+
snapbox::str!["--test=test-hidden\tSay hello to the moon"]
147+
)
148+
}
149+
125150
#[test]
126151
fn suggest_hidden_long_flag_aliases() {
127152
let mut cmd = Command::new("exhaustive")

0 commit comments

Comments
 (0)