mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 13:33:52 +01:00
149 lines
2.6 KiB
Plaintext
149 lines
2.6 KiB
Plaintext
# Tests for completion system.
|
|
|
|
%prep
|
|
. $ZTST_srcdir/comptest
|
|
|
|
mkdir comp.tmp
|
|
cd comp.tmp
|
|
|
|
comptestinit -z $ZTST_testdir/../Src/zsh
|
|
|
|
mkdir dir1
|
|
mkdir dir2
|
|
touch file1
|
|
touch file2
|
|
|
|
%test
|
|
|
|
comptest $': \t\t\t\t\t\t\t'
|
|
0:directories and files
|
|
>line: {: }{}
|
|
>DESCRIPTION:{file}
|
|
>DI:{dir1}
|
|
>DI:{dir2}
|
|
>FI:{file1}
|
|
>FI:{file2}
|
|
>line: {: dir1/}{}
|
|
>line: {: dir2/}{}
|
|
>line: {: file1}{}
|
|
>line: {: file2}{}
|
|
>line: {: dir1/}{}
|
|
>line: {: dir2/}{}
|
|
|
|
comptesteval '_users () { compadd user1 user2 }'
|
|
comptest $': ~\t\t\t\t\t'
|
|
0:tilde
|
|
>line: {: ~user}{}
|
|
>line: {: ~user}{}
|
|
>NO:{user1}
|
|
>NO:{user2}
|
|
>line: {: ~user1}{}
|
|
>line: {: ~user2}{}
|
|
>line: {: ~user1}{}
|
|
|
|
comptest $'echo ;:\C-b\C-b\t'
|
|
0:tilde
|
|
>line: {echo }{;:}
|
|
>DESCRIPTION:{file}
|
|
>DI:{dir1}
|
|
>DI:{dir2}
|
|
>FI:{file1}
|
|
>FI:{file2}
|
|
|
|
comptesteval 'compdef _tst tst; _tst () { _arguments ":desc1:(arg1)" }'
|
|
comptest $'tst \t'
|
|
0:_arguments
|
|
>line: {tst arg1 }{}
|
|
|
|
comptest $'tst a\t'
|
|
0:_arguments
|
|
>line: {tst arg1 }{}
|
|
|
|
comptest $'tst ar\t'
|
|
0:_arguments
|
|
>line: {tst arg1 }{}
|
|
|
|
comptest $'tst arg\t'
|
|
0:_arguments
|
|
>line: {tst arg1 }{}
|
|
|
|
comptest $'tst arg1\t'
|
|
0:_arguments
|
|
>line: {tst arg1 }{}
|
|
|
|
comptest $'tst r\t'
|
|
0:_arguments
|
|
>line: {tst r}{}
|
|
|
|
comptest $'tst x\t'
|
|
0:_arguments
|
|
>line: {tst x}{}
|
|
|
|
comptest $'tst a \t'
|
|
0:_arguments
|
|
>line: {tst a }{}
|
|
>MESSAGE:{no more arguments}
|
|
|
|
comptest $'tst a b \t'
|
|
0:_arguments
|
|
>line: {tst a b }{}
|
|
>MESSAGE:{no more arguments}
|
|
|
|
comptesteval 'compdef _tst tst; _tst () { _arguments ":desc1:(a b)" }'
|
|
comptest $'tst \t'
|
|
0:_arguments
|
|
>line: {tst }{}
|
|
>DESCRIPTION:{desc1}
|
|
>NO:{a}
|
|
>NO:{b}
|
|
|
|
comptesteval 'compdef _tst tst; _tst () { _arguments ":desc1:(arg1)" ":desc2:(arg2)" ":desc3:(arg3)" }'
|
|
comptest $'tst \t'
|
|
0:_arguments
|
|
>line: {tst arg1 }{}
|
|
|
|
comptest $'tst arg1 \t'
|
|
0:_arguments
|
|
>line: {tst arg1 arg2 }{}
|
|
|
|
comptest $'tst arg1 arg2 \t'
|
|
0:_arguments
|
|
>line: {tst arg1 arg2 arg3 }{}
|
|
|
|
comptest $'tst \C-D'
|
|
0:_arguments
|
|
>DESCRIPTION:{desc1}
|
|
>NO:{arg1}
|
|
|
|
comptesteval 'compdef _tst tst; _tst () { _arguments "-\+[opt]" }'
|
|
comptest $'tst -\C-D'
|
|
0:_arguments
|
|
>DESCRIPTION:{option}
|
|
>NO:{-+ -- opt}
|
|
|
|
comptesteval 'compdef _tst tst; _tst () { _arguments "1:desc1:(arg1)" }'
|
|
comptest $'tst \t'
|
|
0:_arguments
|
|
>line: {tst arg1 }{}
|
|
|
|
comptesteval 'compdef _tst tst; _tst () { _arguments "-x" ":arg:" }'
|
|
comptest $'tst -\t'
|
|
0:_arguments
|
|
>line: {tst -}{}
|
|
>MESSAGE:{arg}
|
|
|
|
comptesteval 'compdef _tst tst; _tst () { _arguments "-x:arg:" }'
|
|
comptest $'tst -x\t'
|
|
0:_arguments
|
|
>line: {tst -x }{}
|
|
|
|
comptesteval '
|
|
compdef _tst tst
|
|
_tst () { _arguments "-a" "*::rest:_tst2" }
|
|
_tst2 () { compadd - -b }
|
|
'
|
|
comptest $'tst arg -\t'
|
|
0:_arguments
|
|
>line: {tst arg -b }{}
|
|
|