File tree 2 files changed +27
-1
lines changed
clap_complete/tests/testsuite
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -167,3 +167,29 @@ fn complete() {
167
167
fn register_dynamic_completion ( ) {
168
168
common:: register_example ( "dynamic" , "exhaustive" , completest:: Shell :: Bash ) ;
169
169
}
170
+
171
+ #[ test]
172
+ #[ cfg( all( unix, feature = "unstable-dynamic" ) ) ]
173
+ fn complete_dynamic ( ) {
174
+ if !common:: has_command ( "bash" ) {
175
+ return ;
176
+ }
177
+
178
+ let term = completest:: Term :: new ( ) ;
179
+ let mut runtime = common:: load_runtime ( "dynamic" , "exhaustive" , completest:: Shell :: Bash ) ;
180
+
181
+ let input = "exhaustive \t \t " ;
182
+ let mut expected: Vec < _ > = r#"%
183
+ action help pacman -h --global
184
+ alias hint quote -V --help
185
+ complete last value --generate --version"#
186
+ . split_whitespace ( )
187
+ . collect ( ) ;
188
+ expected. sort ( ) ;
189
+ let expected = expected. join ( " " ) ;
190
+ let actual = runtime. complete ( input, & term) . unwrap ( ) ;
191
+ let mut actual: Vec < _ > = actual. split_whitespace ( ) . collect ( ) ;
192
+ actual. sort ( ) ;
193
+ let actual = actual. join ( " " ) ;
194
+ snapbox:: assert_eq ( expected, actual) ;
195
+ }
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ alias help (Print this message or the help of the given subcommand(s)) last
144
144
snapbox:: assert_eq ( expected, actual) ;
145
145
}
146
146
147
- #[ cfg( feature = "unstable-dynamic" ) ]
147
+ #[ cfg( ( unix , feature = "unstable-dynamic" ) ) ]
148
148
#[ test]
149
149
fn register_dynamic ( ) {
150
150
common:: register_example ( "dynamic" , "exhaustive" , completest:: Shell :: Fish ) ;
You can’t perform that action at this time.
0 commit comments