diff options
| author | dana <dana@dana.is> | 2026-07-04 22:44:45 -0500 |
|---|---|---|
| committer | dana <dana@dana.is> | 2026-07-08 15:39:25 -0500 |
| commit | e426c105cc87dea07ad3458b7744fabffb3b45a4 (patch) | |
| tree | d5d8d95dd578862cd45b45f0751542bedfd6aad6 /Test | |
| parent | unposted: tests: add regression test for w/54909 (diff) | |
| download | zsh-e426c105cc87dea07ad3458b7744fabffb3b45a4.tar zsh-e426c105cc87dea07ad3458b7744fabffb3b45a4.tar.gz zsh-e426c105cc87dea07ad3458b7744fabffb3b45a4.tar.bz2 zsh-e426c105cc87dea07ad3458b7744fabffb3b45a4.tar.lz zsh-e426c105cc87dea07ad3458b7744fabffb3b45a4.tar.xz zsh-e426c105cc87dea07ad3458b7744fabffb3b45a4.tar.zst zsh-e426c105cc87dea07ad3458b7744fabffb3b45a4.zip | |
54912: _call_program: add -qQ options, etc
Diffstat (limited to 'Test')
| -rw-r--r-- | Test/Y07call_program.ztst | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/Test/Y07call_program.ztst b/Test/Y07call_program.ztst new file mode 100644 index 000000000..19eca8f9f --- /dev/null +++ b/Test/Y07call_program.ztst @@ -0,0 +1,107 @@ +# tests for _call_program + +%prep + + if ( zmodload -s zsh/zpty ); then + source $ZTST_srcdir/comptest + mkdir comp.tmp + cd comp.tmp + comptestinit -z $ZTST_testdir/../Src/zsh && { + comptesteval ' + pp() { printf "<%s>" "$@"; print } + compdef _tst tst + ' + tst_call_program() { + comptesteval "_tst() { + [[ ${(q+)1} == -[lpqQ]#p[lpqQ]# ]] && + local -a _comp_priv_prefix=( print -r priv ) + local ret=\${ _call_program ${${(@q+)@}} } + _message - \$ret + }" + comptest $'tst \t' + } + } + else + ZTST_unimplemented='the zsh/zpty module is not available' + fi + +%test + + tst_call_program tag pp a b c + tst_call_program tag pp 'a b c' + tst_call_program tag pp '"a b c"' +0:basic command arguments +>line: {tst }{} +>MESSAGE:{<a><b><c>} +>line: {tst }{} +>MESSAGE:{<a><b><c>} +>line: {tst }{} +>MESSAGE:{<a b c>} + + for 1 in -q -Q; do + tst_call_program $1 tag pp $1 a b c + tst_call_program $1 tag pp $1 'a b c' + tst_call_program $1 tag pp $1 '"a b c"' + done +0:-qQ: argument quoting +>line: {tst }{} +>MESSAGE:{<-q><a><b><c>} +>line: {tst }{} +>MESSAGE:{<-q><a b c>} +>line: {tst }{} +>MESSAGE:{<-q><"a b c">} +>line: {tst }{} +>MESSAGE:{<-Q><a><b><c>} +>line: {tst }{} +>MESSAGE:{<-Q><a b c>} +>line: {tst }{} +>MESSAGE:{<-Q><"a b c">} + + tst_call_program tag '"pp"' a b c + tst_call_program -q tag '"pp"' a b c + tst_call_program -Q tag '"pp"' a b c +0:-qQ: command-name quoting +>line: {tst }{} +>MESSAGE:{<a><b><c>} +>line: {tst }{} +>MESSAGE:{} +>line: {tst }{} +>MESSAGE:{<a><b><c>} + + if [[ -z ${lc::=${ ZTST_find_UTF8 }} ]]; then + ZTST_skip='no utf8 locale' + else + comptesteval "old_LC_ALL=\$LC_ALL; LC_ALL=${(q+)lc}" + for 1 in '' -l; do + tst_call_program $1 tag ' + local -a arr=( z e é ) + print -r - ${(o)arr} + ' + done + comptesteval 'LC_ALL=$old_LC_ALL' + fi +0:-l +>line: {tst }{} +>MESSAGE:{e z é} +>line: {tst }{} +>MESSAGE:{e é z} + + tst_call_program tag print a b c + tst_call_program -p tag print a b c + comptesteval 'zstyle ":completion:*" gain-privileges yes' + tst_call_program tag print a b c + tst_call_program -p tag print a b c + comptesteval 'zstyle -d ":completion:*" gain-privileges' +0:-p +>line: {tst }{} +>MESSAGE:{a b c} +>line: {tst }{} +>MESSAGE:{a b c} +>line: {tst }{} +>MESSAGE:{a b c} +>line: {tst }{} +>MESSAGE:{priv print a b c} + +%clean + + zmodload -ui zsh/zpty |
