# 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:{} >line: {tst }{} >MESSAGE:{} >line: {tst }{} >MESSAGE:{} 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>} >line: {tst }{} >MESSAGE:{<-q>} >line: {tst }{} >MESSAGE:{<-q><"a b c">} >line: {tst }{} >MESSAGE:{<-Q>} >line: {tst }{} >MESSAGE:{<-Q>} >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:{} >line: {tst }{} >MESSAGE:{} >line: {tst }{} >MESSAGE:{} if [[ -z ${lc::=${ ZTST_find_UTF8 }} ]]; then ZTST_skip='no utf8 locale' else comptesteval "old_LC_ALL=\$LC_ALL; lc=$lc; LC_ALL=$lc" # without -l: _comp_locale sets LC_CTYPE=$lc, LC_ALL=, LANG=C tst_call_program tag ' [[ $LC_CTYPE != $lc ]] && echo "bad LC_CTYPE (without -l)" print -r - LANG=$LANG LC_ALL=$LC_ALL ' # with -l: locale doesn't change: LC_ALL=$lc tst_call_program -l tag ' [[ $LC_ALL != $lc ]] && echo "LC_ALL changed (with -l)" ' comptesteval 'LC_ALL=$old_LC_ALL' fi 0:-l >line: {tst }{} >MESSAGE:{LANG=C LC_ALL=} >line: {tst }{} >MESSAGE:{} 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