Port complete tests to littlecheck

This commit is contained in:
Fabian Homborg 2019-07-03 12:57:23 +02:00
parent 87b05d3111
commit f1fa8d5f5b
3 changed files with 13 additions and 28 deletions

View file

@ -1,5 +1,4 @@
logmsg Completion Wrappers # RUN: %fish %s
function complete_test_alpha1; echo $argv; end function complete_test_alpha1; echo $argv; end
complete -c complete_test_alpha1 --no-files -a '(commandline)' complete -c complete_test_alpha1 --no-files -a '(commandline)'
@ -7,28 +6,36 @@ complete -c complete_test_alpha2 --no-files -w 'complete_test_alpha1 extra1'
complete -c complete_test_alpha3 --no-files -w 'complete_test_alpha2 extra2' complete -c complete_test_alpha3 --no-files -w 'complete_test_alpha2 extra2'
complete -C'complete_test_alpha1 arg1 ' complete -C'complete_test_alpha1 arg1 '
# CHECK: complete_test_alpha1 arg1
complete -C'complete_test_alpha2 arg2 ' complete -C'complete_test_alpha2 arg2 '
# CHECK: complete_test_alpha1 extra1 arg2
complete -C'complete_test_alpha3 arg3 ' complete -C'complete_test_alpha3 arg3 '
# CHECK: complete_test_alpha1 extra1 extra2 arg3
# Works even with the argument as a separate token. # Works even with the argument as a separate token.
complete -C 'complete_test_alpha3 arg3 ' complete -C 'complete_test_alpha3 arg3 '
# CHECK: complete_test_alpha1 extra1 extra2 arg3
logmsg Alias Completions
alias myalias1 'complete_test_alpha1 arg1' alias myalias1 'complete_test_alpha1 arg1'
alias myalias2='complete_test_alpha1 arg2' alias myalias2='complete_test_alpha1 arg2'
myalias1 call1 myalias1 call1
myalias2 call2 myalias2 call2
# CHECK: arg1 call1
# CHECK: arg2 call2
complete -C'myalias1 call3 ' complete -C'myalias1 call3 '
complete -C'myalias2 call3 ' complete -C'myalias2 call3 '
# CHECK: complete_test_alpha1 arg1 call3
# CHECK: complete_test_alpha1 arg2 call3
# Ensure that commands can't wrap themselves - if this did, # Ensure that commands can't wrap themselves - if this did,
# the completion would be executed a bunch of times. # the completion would be executed a bunch of times.
function t --wraps t; echo t; end function t --wraps t; echo t; end
complete -c t -fa '(t)' complete -c t -fa '(t)'
complete -C't ' complete -C't '
# CHECK: t
# Ensure file completion happens even though it was disabled above. # Ensure file completion happens even though it was disabled above.
complete -c t -l fileoption -rF complete -c t -l fileoption -rF
# Only match this file because I don't want to touch this any time we add a test file. # Only match one file because I don't want to touch this any time we add a test file.
complete -C't --fileoption ' | string match complete.in complete -C't --fileoption ' | string match bind.expect
# CHECK: bind.expect

View file

@ -1,6 +0,0 @@
####################
# Completion Wrappers
####################
# Alias Completions

View file

@ -1,16 +0,0 @@
####################
# Completion Wrappers
complete_test_alpha1 arg1
complete_test_alpha1 extra1 arg2
complete_test_alpha1 extra1 extra2 arg3
complete_test_alpha1 extra1 extra2 arg3
####################
# Alias Completions
arg1 call1
arg2 call2
complete_test_alpha1 arg1 call3
complete_test_alpha1 arg2 call3
t
complete.in