-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
serg-v
committed
Feb 24, 2023
1 parent
1af8274
commit a144222
Showing
11 changed files
with
192 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Run | ||
``` | ||
runtest --outdir log --tool completion | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
set timeout 1 | ||
|
||
# Setup completion and fake command | ||
send "source ../resources/basic.fish\r" | ||
expect -re "(.+>)" | ||
|
||
send "function basicExample; echo 'do'; end\r" | ||
expect -re "(.+>)" | ||
|
||
set cmd "basicExample -" | ||
set test "Tab should show options for '$cmd'" | ||
set candidates "-t -u --timeout --timeUnit --timeUnit=" | ||
run_completion_test $cmd $test $candidates | ||
|
||
set cmd "basicExample --" | ||
set test "Tab should show options for '$cmd'" | ||
set candidates "--timeout --timeUnit --timeUnit=" | ||
run_completion_test $cmd $test $candidates | ||
|
||
set cmd "basicExample --timeUnit=" | ||
set test "Tab should show time unit enum values for '$cmd'" | ||
#set candidates "1 2 3" | ||
set candidates "\u2026timeUnit=DAYS \u2026timeUnit=MICROSECONDS \u2026timeUnit=MINUTES \u2026timeUnit=SECONDS\r\n\u2026timeUnit=HOURS \u2026timeUnit=MILLISECONDS \u2026timeUnit=NANOSECONDS " | ||
run_completion_test $cmd $test $candidates |
14 changes: 14 additions & 0 deletions
14
src/test/dejagnu.fishtests/completion/picocompletion-demo.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
exp_internal 1 | ||
set timeout 1 | ||
|
||
# Setup completion and fake command | ||
send "source ../resources/picocompletion-demo_completion.fish\r" | ||
expect -re "(.+>)" | ||
|
||
send "function picocompletion-demo; echo 'do'; end\r" | ||
expect -re "(.+>)" | ||
|
||
set cmd "picocompletion-demo " | ||
set test "Tab should show sub1 and sub2 for '${cmd}'" | ||
set candidates "sub1.*sub1-alias.*sub2.*sub2-alias.*" | ||
run_completion_test $cmd $test $candidates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exp_spawn fish --no-config | ||
expect -re "(.+>)" | ||
|
||
source $::srcdir/lib/library.exp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
proc run_completion_test {cmd test candidates} { | ||
send "${cmd}\t" | ||
expect { | ||
-re "(\n${candidates}\u001b)" { pass $test } | ||
timeout { fail $test } | ||
} | ||
puts "###Output" | ||
puts "$expect_out(1,string)" | ||
send "\x03" | ||
expect ">" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# root completion | ||
set -l root | ||
complete -c basicExample -n "not __fish_seen_subcommand_from $root" -l timeUnit -f -a 'NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS' -d '' | ||
complete -c basicExample -n "not __fish_seen_subcommand_from $root" -s u -d '' | ||
complete -c basicExample -n "not __fish_seen_subcommand_from $root" -l timeout -d '' | ||
complete -c basicExample -n "not __fish_seen_subcommand_from $root" -s t -d '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
# root completion | ||
set -l root | ||
complete -c picocompletion-demo -n "not __fish_seen_subcommand_from $root" -l version -d '' | ||
complete -c picocompletion-demo -n "not __fish_seen_subcommand_from $root" -s V -d '' | ||
complete -c picocompletion-demo -n "not __fish_seen_subcommand_from $root" -l help -d '' | ||
complete -c picocompletion-demo -n "not __fish_seen_subcommand_from $root" -s h -d '' | ||
|
||
# _picocli_picocompletion_demo completion | ||
set -l _picocli_picocompletion_demo sub1 sub1-alias sub2 sub2-alias | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo" -a sub1 -d 'First level subcommand 1' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub1" -l num -d 'a number' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub1" -l str -d 'a String' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub1" -l candidates -a 'aaa bbb ccc' -d 'with candidates' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo" -a sub1-alias -d 'First level subcommand 1' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub1-alias" -l num -d 'a number' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub1-alias" -l str -d 'a String' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub1-alias" -l candidates -a 'aaa bbb ccc' -d 'with candidates' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo" -a sub2 -d 'First level subcommand 2' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2" -l num2 -d 'another number' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2" -l directory -d 'a directory' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2" -s d -d 'a directory' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo" -a sub2-alias -d 'First level subcommand 2' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2-alias" -l num2 -d 'another number' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2-alias" -l directory -d 'a directory' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2-alias" -s d -d 'a directory' | ||
|
||
# _picocli_picocompletion_demo_sub2 completion | ||
set -l _picocli_picocompletion_demo_sub2 subsub1 sub2child1-alias subsub2 sub2child2-alias subsub3 sub2child3-alias | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2" -n '__fish_seen_subcommand_from sub2' -a subsub1 -d 'Second level sub-subcommand 1' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub1" -n '__fish_seen_subcommand_from sub2' -l host -d 'a host' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub1" -n '__fish_seen_subcommand_from sub2' -s h -d 'a host' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2" -n '__fish_seen_subcommand_from sub2' -a sub2child1-alias -d 'Second level sub-subcommand 1' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child1-alias" -n '__fish_seen_subcommand_from sub2' -l host -d 'a host' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child1-alias" -n '__fish_seen_subcommand_from sub2' -s h -d 'a host' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2" -n '__fish_seen_subcommand_from sub2' -a subsub2 -d 'Second level sub-subcommand 2' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub2" -n '__fish_seen_subcommand_from sub2' -l timeUnit -a 'NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS' -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub2" -n '__fish_seen_subcommand_from sub2' -s u -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub2" -n '__fish_seen_subcommand_from sub2' -l timeout -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub2" -n '__fish_seen_subcommand_from sub2' -s t -d '' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2" -n '__fish_seen_subcommand_from sub2' -a sub2child2-alias -d 'Second level sub-subcommand 2' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child2-alias" -n '__fish_seen_subcommand_from sub2' -l timeUnit -a 'NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS' -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child2-alias" -n '__fish_seen_subcommand_from sub2' -s u -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child2-alias" -n '__fish_seen_subcommand_from sub2' -l timeout -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child2-alias" -n '__fish_seen_subcommand_from sub2' -s t -d '' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2" -n '__fish_seen_subcommand_from sub2' -a subsub3 -d 'Second level sub-subcommand 3' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2" -n '__fish_seen_subcommand_from sub2' -a sub2child3-alias -d 'Second level sub-subcommand 3' | ||
|
||
# _picocli_picocompletion_demo_sub2alias completion | ||
set -l _picocli_picocompletion_demo_sub2alias subsub1 sub2child1-alias subsub2 sub2child2-alias subsub3 sub2child3-alias | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2alias" -n '__fish_seen_subcommand_from sub2-alias' -a subsub1 -d 'Second level sub-subcommand 1' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub1" -n '__fish_seen_subcommand_from sub2-alias' -l host -d 'a host' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub1" -n '__fish_seen_subcommand_from sub2-alias' -s h -d 'a host' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2alias" -n '__fish_seen_subcommand_from sub2-alias' -a sub2child1-alias -d 'Second level sub-subcommand 1' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child1-alias" -n '__fish_seen_subcommand_from sub2-alias' -l host -d 'a host' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child1-alias" -n '__fish_seen_subcommand_from sub2-alias' -s h -d 'a host' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2alias" -n '__fish_seen_subcommand_from sub2-alias' -a subsub2 -d 'Second level sub-subcommand 2' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub2" -n '__fish_seen_subcommand_from sub2-alias' -l timeUnit -a 'NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS' -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub2" -n '__fish_seen_subcommand_from sub2-alias' -s u -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub2" -n '__fish_seen_subcommand_from sub2-alias' -l timeout -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from subsub2" -n '__fish_seen_subcommand_from sub2-alias' -s t -d '' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2alias" -n '__fish_seen_subcommand_from sub2-alias' -a sub2child2-alias -d 'Second level sub-subcommand 2' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child2-alias" -n '__fish_seen_subcommand_from sub2-alias' -l timeUnit -a 'NANOSECONDS MICROSECONDS MILLISECONDS SECONDS MINUTES HOURS DAYS' -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child2-alias" -n '__fish_seen_subcommand_from sub2-alias' -s u -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child2-alias" -n '__fish_seen_subcommand_from sub2-alias' -l timeout -d '' | ||
complete -c picocompletion-demo -n "__fish_seen_subcommand_from sub2child2-alias" -n '__fish_seen_subcommand_from sub2-alias' -s t -d '' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2alias" -n '__fish_seen_subcommand_from sub2-alias' -a subsub3 -d 'Second level sub-subcommand 3' | ||
complete -c picocompletion-demo -f -n "not __fish_seen_subcommand_from $_picocli_picocompletion_demo_sub2alias" -n '__fish_seen_subcommand_from sub2-alias' -a sub2child3-alias -d 'Second level sub-subcommand 3' |