From 20a527fcaa555387a69fe941298d1ab04eccc88b Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Wed, 17 May 2000 12:31:32 +0000 Subject: 11441: Test/comptest, Test/53completion.ztst, Test/54compmatch.ztst: use only one zsh process to test for each completion test file. --- Test/comptest | 140 +++++++++++++++++++++++++++------------------------------- 1 file changed, 66 insertions(+), 74 deletions(-) (limited to 'Test/comptest') diff --git a/Test/comptest b/Test/comptest index 6a37bb15e..0b6962d6e 100644 --- a/Test/comptest +++ b/Test/comptest @@ -1,39 +1,34 @@ -#!/usr/local/bin/zsh -f +comptestinit () { + setopt extendedglob + [[ -d $ZTST_testdir/Modules/zsh ]] && module_path=( $ZTST_testdir/Modules ) + fpath=( $ZTST_srcdir/../(Completion|Functions)/*~*/CVS(/) ) -[[ -d $ZTST_testdir/Modules/zsh ]] && module_path=( $ZTST_testdir/Modules ) + zmodload -i zsh/zpty -zmodload -i zsh/zpty -setopt extendedglob + comptest_zsh=${ZSH:-zsh} + termcap_ce="$(echotc ce)" -fpath=( $ZTST_srcdir/../(Completion|Functions)/*~*/CVS(/) ) - -debug= -dump=(-D) -code= -zsh=${ZSH:-zsh} -termcap_ce="$(echotc ce)" - -debug=yes -while getopts Dd:c:z: opt; do - case $opt in - D) debug=yes;; - d) dump=(-d "$OPTARG");; - c) code="$OPTARG";; - z) zsh="$OPTARG";; - esac -done -(( OPTIND > 1 )) && shift $(( OPTIND - 1 )) + while getopts z: opt; do + case $opt in + z) comptest_zsh="$OPTARG";; + esac + done + (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) -input="$*" + export PS1="" + zpty zsh "$comptest_zsh" -f -tmp=/tmp/comptest.$$ + zpty -r zsh log1 "**" || { + print "first prompt doesn't appered." + return 1 + } -cat <$tmp -module_path=( $module_path ) -fpath=( $fpath ) + comptesteval \ +"module_path=( $module_path )" \ +"fpath=( $fpath )" \ +"ZLS_COLORS='no=:fi=:di=:ln=:pi=:so=:bd=:cd=:ex=:mi=:tc=:sp=:lc=:ec=\\n:rc='" \ +'LISTMAX=10000000 stty columns 80 rows 24 -LISTMAX=10000000 -ZLS_COLORS='no=:fi=:di=:ln=:pi=:so=:bd=:cd=:ex=:mi=:tc=:sp=:lc=:ec=\n:rc=' bindkey -e autoload -U compinit compinit $dump @@ -49,7 +44,7 @@ zmodload zsh/complist expand-or-complete-with-report () { print -lr "" zle expand-or-complete - print -lr - "\$LBUFFER" "\$RBUFFER" + print -lr - "$LBUFFER" "$RBUFFER" zle clear-screen zle -R } @@ -61,8 +56,9 @@ list-choices-with-report () { } finish () { print "" - sleep 1 - exit 0 + zle kill-whole-line + zle clear-screen + zle -R } zle -N expand-or-complete-with-report zle -N list-choices-with-report @@ -70,54 +66,50 @@ zle -N finish bindkey "^I" expand-or-complete-with-report bindkey "^D" list-choices-with-report bindkey "^Z" finish -$code -End - -export PS1="" -zpty zsh "$zsh" -f - -zpty -r zsh log1 "**" || { - print first prompt doesn\'t appered. - exit 1 +' } -zpty -w zsh ". $tmp" -zpty -r zsh log2 "**" || { - print second prompt doesn\'t appered. - exit 1 -} -rm $tmp +comptesteval () { + local tmp=/tmp/comptest.$$ -zpty -n -w zsh "$input"$'\C-Z' -zpty -r zsh log "**" || { - print finish widget doesn\'t invoked. - exit 1 + print -lr - "$@" > $tmp + zpty -w zsh ". $tmp" + zpty -r zsh log_eval "**" || { + print "prompt doesn't appered." + return 1 + } + rm $tmp } -if [[ -n "$debug" ]]; then - print -lr - "$log" > /tmp/comptest.debug -fi +comptest () { + input="$*" + zpty -n -w zsh "$input"$'\C-Z' + zpty -r zsh log "***" || { + print "finish widget doesn't invoked." + return 1 + } -logs=(${(s::)log}) -shift logs + logs=(${(s::)log}) + shift logs -for log in "$logs[@]"; do - if [[ "$log" = (#b)*$''(*)$'\r\n'(*)$''* ]]; then - print -lr "line: {$match[1]}{$match[2]}" - fi - while (( ${(N)log#*(#b)(<(??)>(*)|(*)|(*)|(*))} )); do - log="${log[$mend[1]+1,-1]}" - if (( 0 <= $mbegin[2] )); then - if [[ $match[2] != TC && $match[3] != \ # ]]; then - print -lr "$match[2]:{${match[3]%$termcap_ce}}" - fi - elif (( 0 <= $mbegin[4] )); then - print -lr "DESCRIPTION:{$match[4]}" - elif (( 0 <= $mbegin[5] )); then - print -lr "MESSAGE:{$match[5]}" - elif (( 0 <= $mbegin[6] )); then - result=`echo $match[6] | tr -d '\012\015'` - print -lr "COMPADD:{$result}" + for log in "$logs[@]"; do + if [[ "$log" = (#b)*$''(*)$'\r\n'(*)$''* ]]; then + print -lr "line: {$match[1]}{$match[2]}" fi + while (( ${(N)log#*(#b)(<(??)>(*)|(*)|(*)|(*))} )); do + log="${log[$mend[1]+1,-1]}" + if (( 0 <= $mbegin[2] )); then + if [[ $match[2] != TC && $match[3] != \ # ]]; then + print -lr "$match[2]:{${match[3]%$termcap_ce}}" + fi + elif (( 0 <= $mbegin[4] )); then + print -lr "DESCRIPTION:{$match[4]}" + elif (( 0 <= $mbegin[5] )); then + print -lr "MESSAGE:{$match[5]}" + elif (( 0 <= $mbegin[6] )); then + result=`echo $match[6] | tr -d '\012\015'` + print -lr "COMPADD:{$result}" + fi + done done -done +} -- cgit 1.4.1