@@ -328,3 +328,33 @@ fn complete_dynamic_empty_option_value() {
328328 let actual = runtime. complete ( input, & term) . unwrap ( ) ;
329329 assert_data_eq ! ( actual, expected) ;
330330}
331+
332+ #[ test]
333+ #[ cfg( all( unix, feature = "unstable-dynamic" ) ) ]
334+ #[ cfg( feature = "unstable-shell-tests" ) ]
335+ fn complete_dynamic_empty_space ( ) {
336+ if !common:: has_command ( CMD ) {
337+ return ;
338+ }
339+
340+ let term = completest:: Term :: new ( ) ;
341+ let mut runtime = common:: load_runtime :: < RuntimeBuilder > ( "dynamic-env" , "exhaustive" ) ;
342+
343+ // Press left arrow twice to place cursor between the two spaces
344+ let input = "exhaustive quote -\x1b [D\x1b [D\t \t " ;
345+ let expected = snapbox:: str![ [ r#"
346+ % exhaustive quote -
347+ --help -- Print help (see more with '--help')
348+ cmd-backslash --backslash -- Avoid '/n'
349+ cmd-backticks --backticks -- For more information see `echo test`
350+ cmd-brackets --brackets -- List packages [filter]
351+ cmd-double-quotes --double-quotes -- Can be "always", "auto", or "never"
352+ cmd-expansions --expansions -- Execute the shell command with $SHELL
353+ cmd-single-quotes --single-quotes -- Can be 'always', 'auto', or 'never'
354+ escape-help -- /tab/t"'
355+ help -- Print this message or the help of the given subcommand(s)
356+ --choice
357+ "# ] ] ;
358+ let actual = runtime. complete ( input, & term) . unwrap ( ) ;
359+ assert_data_eq ! ( actual, expected) ;
360+ }
0 commit comments