Subject: Zsh test failure
From: Leo Famulari <[email-masked]>
To: [email-masked]
Date: Wed, 20 Jan 2016 21:21:20 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Zsh fails to build due to a test failure on my system (x86_64).

The test suite does not report where the failure occurs but I believe it
is in section 'Test/B02typeset.ztst' as a result of patch-shebang
failing to find a binary interpreter for 'Test/ztst.zsh':

patch-shebang: ./Test/ztst.zsh: warning: no binary for interpreter `zsh' found in $PATH

I wonder if this means that the file is being interpreted by Bash, or
maybe the 'sh' mode of Bash.

At the conclusion of the test suite:

**************************************
44 successful test scripts, 1 failure, 0 skipped
**************************************
Makefile:189: recipe for target 'check' failed
make[1]: *** [check] Error 1
make[1]: Leaving directory '/tmp/guix-build-zsh-5.1.1.drv-0/zsh-5.1.1/Test'
Makefile:265: recipe for target 'check' failed
make: *** [check] Error 2
phase `check' failed after 30.2 seconds

Here is the verbose output of the test section B02, up to where section
B03 begins. I created the verbose output by setting the make-flag
"ZTST_verbose=2".

Normally, before a new section begins, the previous section reports its
success. That does not happen in this case:

./B02typeset.ztst: starting.
ZTST_getsect: read section name: prep
ZTST_getchunk: read code chunk:
  mkdir typeset.tmp && cd typeset.tmp
ZTST_execchunk: status 0
ZTST_getchunk: read code chunk:
  setopt noglob
ZTST_execchunk: status 0
ZTST_getchunk: read code chunk:
  scalar=scalar
  array=(a r r a y)
ZTST_execchunk: status 0
ZTST_getchunk: read code chunk:
  scope00() {
    typeset scalar
    scalar=local
    typeset -a array
    array=(l o c a l)
    print $scalar $array
  }
  scope01() {
    local scalar
    scalar=local
    local -a array
    array=(l o c a l)
    print $scalar $array
  }
  scope02() {
    declare scalar
    scalar=local
    declare -a array
    array=(l o c a l)
    print $scalar $array
  }
  scope10() {
    export outer=outer
    /gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh -fc 'echo $outer'
  }
  scope11() {
    typeset -x outer=outer
    /gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh -fc 'echo $outer'
  }
  scope12() {
    local -x outer=inner
    /gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh -fc 'echo $outer'
  }
  scope13() {
    local -xT OUTER outer
    outer=(i n n e r)
    /gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh -fc 'echo $OUTER'
  }
ZTST_execchunk: status 0
ZTST_getchunk: read code chunk:
  # Bug?  `typeset -h' complains that ! # $ * - ? @ are not identifiers.
  stress00() {
    typeset -h +g -m [[:alpha:]_]*
    unset -m [[:alpha:]_]*
    typeset +m [[:alpha:]_]*
  }
ZTST_execchunk: status 0
ZTST_getchunk: read code chunk:

ZTST_getsect: read section name: test
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset +m scalar array
ZTST_getchunk: read code chunk:
 typeset +m scalar array
ZTST_test: examining line:
>scalar
ZTST_getredir: read redir for '>':
scalar
array array
ZTST_test: examining line:

Running test: Report types of parameters with typeset +m
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
scalar
array array
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 scope00
ZTST_getchunk: read code chunk:
 scope00
 print $scalar $array
ZTST_test: examining line:
>local l o c a l
ZTST_getredir: read redir for '>':
local l o c a l
scalar a r r a y
ZTST_test: examining line:

Running test: Simple local declarations
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
local l o c a l
scalar a r r a y
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 scope01
ZTST_getchunk: read code chunk:
 scope01
 print $scalar $array
ZTST_test: examining line:
>local l o c a l
ZTST_getredir: read redir for '>':
local l o c a l
scalar a r r a y
ZTST_test: examining line:

Running test: Equivalence of local and typeset in functions
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
local l o c a l
scalar a r r a y
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 scope02
ZTST_getchunk: read code chunk:
 scope02
 print $scalar $array
ZTST_test: examining line:
>local l o c a l
ZTST_getredir: read redir for '>':
local l o c a l
scalar a r r a y
ZTST_test: examining line:

Running test: Basic equivalence of declare and typeset
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
local l o c a l
scalar a r r a y
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 declare +m scalar
ZTST_getchunk: read code chunk:
 declare +m scalar
ZTST_test: examining line:
>scalar
ZTST_getredir: read redir for '>':
scalar
ZTST_test: examining line:

Running test: declare previously lacked -m/+m options
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
scalar
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 scope10
ZTST_getchunk: read code chunk:
 scope10
 print $outer
ZTST_test: examining line:
>outer
ZTST_getredir: read redir for '>':
outer
outer
ZTST_test: examining line:

Running test: Global export
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
outer
outer
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 scope11
ZTST_getchunk: read code chunk:
 scope11
 print $outer
ZTST_test: examining line:
>outer
ZTST_getredir: read redir for '>':
outer
outer
ZTST_test: examining line:

Running test: Equivalence of export and typeset -x
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
outer
outer
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 scope12
ZTST_getchunk: read code chunk:
 scope12
 print $outer
ZTST_test: examining line:
>inner
ZTST_getredir: read redir for '>':
inner
outer
ZTST_test: examining line:

Running test: Local export
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
inner
outer
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 float f=3.14159
ZTST_getchunk: read code chunk:
 float f=3.14159
 typeset +m f
 float -E3 f
 print $f
 float -F f
 print $f
ZTST_test: examining line:
>float local f
ZTST_getredir: read redir for '>':
float local f
3.14e+00
3.142
ZTST_test: examining line:

Running test: Floating point, adding a precision, and fixed point
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
float local f
3.14e+00
3.142
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 integer i=3.141
ZTST_getchunk: read code chunk:
 integer i=3.141
 typeset +m i
 integer -i2 i
 print $i
ZTST_test: examining line:
>integer local i
ZTST_getredir: read redir for '>':
integer local i
2#11
ZTST_test: examining line:

Running test: Integer and changing the base
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
integer local i
2#11
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 float -E3 f=3.141
ZTST_getchunk: read code chunk:
 float -E3 f=3.141
 typeset +m f
 integer -i2 f
 typeset +m f
 print $f
ZTST_test: examining line:
>float local f
ZTST_getredir: read redir for '>':
float local f
integer 2 local f
2#11
ZTST_test: examining line:

Running test: Conversion of floating point to integer
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
float local f
integer 2 local f
2#11
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -f
ZTST_getchunk: read code chunk:
 typeset -f
ZTST_test: examining line:
>$(functions)
ZTST_getredir: read redir for '>':
$(functions)
ZTST_test: examining line:

Running test: Equivalence of functions and typeset -f
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
ZTST_cleanup () {
	cd $ZTST_testdir
	rm -rf $ZTST_testdir/dummy.tmp $ZTST_testdir/*.tmp(N) ${TMPPREFIX}.ztst*$$(N)
}
ZTST_diff () {
	emulate -L zsh
	setopt extendedglob
	local diff_out
	integer diff_pat diff_ret
	case $1 in
		(p) diff_pat=1  ;;
		(d)  ;;
		(*) print "Bad ZTST_diff code: d for diff, p for pattern match" ;;
	esac
	shift
	if (( diff_pat ))
	then
		local -a diff_lines1 diff_lines2
		integer failed i
		diff_lines1=("${(f)$(<$argv[-2])}") 
		diff_lines2=("${(f)$(<$argv[-1])}") 
		if (( ${#diff_lines1} != ${#diff_lines2} ))
		then
			failed=1 
		else
			for ((i = 1; i <= ${#diff_lines1}; i++ )) do
				if [[ ${diff_lines2[i]} != ${~diff_lines1[i]} ]]
				then
					failed=1 
					break
				fi
			done
		fi
		if (( failed ))
		then
			print -rl "Pattern match failed:" \<${^diff_lines1} \>${^diff_lines2}
			diff_ret=1 
		fi
	else
		diff_out=$(diff "$@") 
		diff_ret="$?" 
		if [[ "$diff_ret" != "0" ]]
		then
			print -r "$diff_out"
		fi
	fi
	return "$diff_ret"
}
ZTST_execchunk () {
	setopt localloops
	options=($ZTST_testopts) 
	() {
		unsetopt localloops
		eval "$ZTST_code"
	}
	ZTST_status=$? 
	ZTST_testopts=(${(kv)options[*]}) 
	options=(${ZTST_mainopts[*]}) 
	ZTST_verbose 2 "ZTST_execchunk: status $ZTST_status"
	return $ZTST_status
}
ZTST_getchunk () {
	ZTST_code='' 
	while [[ $ZTST_curline = [[:blank:]]# ]]
	do
		ZTST_getline || break
	done
	while [[ $ZTST_curline = [[:blank:]]##[^[:blank:]]* ]]
	do
		ZTST_code="${ZTST_code:+${ZTST_code}
}${ZTST_curline}" 
		ZTST_getline || break
	done
	ZTST_verbose 2 "ZTST_getchunk: read code chunk:
$ZTST_code"
	[[ -n $ZTST_code ]]
}
ZTST_getline () {
	local IFS= 
	while true
	do
		read -u $ZTST_input -r ZTST_curline || return 1
		[[ $ZTST_curline = \#* ]] || return 0
	done
}
ZTST_getredir () {
	local char=${ZTST_curline[1]} fn 
	ZTST_redir=${ZTST_curline[2,-1]} 
	while ZTST_getline
	do
		[[ $ZTST_curline[1] = $char ]] || break
		ZTST_redir="${ZTST_redir}
${ZTST_curline[2,-1]}" 
	done
	ZTST_verbose 2 "ZTST_getredir: read redir for '$char':
$ZTST_redir"
	case $char in
		('<') fn=$ZTST_in  ;;
		('>') fn=$ZTST_out  ;;
		('?') fn=$ZTST_err  ;;
		(*) ZTST_testfailed "bad redir operator: $char"
			return 1 ;;
	esac
	if [[ $ZTST_flags = *q* && $char = '<' ]]
	then
		print -r -- "${(e)ZTST_redir}" >> $fn
	else
		print -r -- "$ZTST_redir" >> $fn
	fi
	return 0
}
ZTST_getsect () {
	local match mbegin mend
	while [[ $ZTST_curline != '%'(#b)([[:alnum:]]##)* ]]
	do
		ZTST_getline || return 1
		[[ $ZTST_curline = [[:blank:]]# ]] && continue
		if [[ $# -eq 0 && $ZTST_curline != '%'[[:alnum:]]##* ]]
		then
			ZTST_testfailed "bad line found before or after section:
$ZTST_curline"
			exit 1
		fi
	done
	ZTST_getline
	ZTST_cursect=${match[1]} 
	ZTST_verbose 2 "ZTST_getsect: read section name: $ZTST_cursect"
	return 0
}
ZTST_hashmark () {
	if [[ ZTST_verbose -le 0 && -t $ZTST_fd ]]
	then
		print -n -u$ZTST_fd -- ${(pl:SECONDS::\#::\#\r:)}
	fi
	(( SECONDS > COLUMNS+1 && (SECONDS -= COLUMNS) ))
}
ZTST_prepclean () {
	while ZTST_getchunk
	do
		ZTST_execchunk > /dev/null || [[ -n $1 ]] || {
			[[ -n "$ZTST_unimplemented" ]] || ZTST_testfailed "non-zero status from preparation code:
$ZTST_code" && return 0
		}
	done
}
ZTST_test () {
	local last match mbegin mend found substlines
	local diff_out diff_err
	local ZTST_skip
	while true
	do
		rm -f $ZTST_in $ZTST_out $ZTST_err
		touch $ZTST_in $ZTST_out $ZTST_err
		ZTST_message='' 
		ZTST_failmsg='' 
		found=0 
		diff_out=d 
		diff_err=d 
		ZTST_verbose 2 "ZTST_test: looking for new test"
		while true
		do
			ZTST_verbose 2 "ZTST_test: examining line:
$ZTST_curline"
			case $ZTST_curline in
				(%*) if [[ $found = 0 ]]
					then
						break 2
					else
						last=1 
						break
					fi ;;
				([[:space:]]#) if [[ $found = 0 ]]
					then
						ZTST_getline || break 2
						continue
					else
						break
					fi ;;
				([[:space:]]##[^[:space:]]*) ZTST_getchunk
					if [[ $ZTST_curline = (#b)([-0-9]##)([[:alpha:]]#)(:*)# ]]
					then
						ZTST_xstatus=$match[1] 
						ZTST_flags=$match[2] 
						ZTST_message=${match[3]:+${match[3][2,-1]}} 
					else
						ZTST_testfailed "expecting test status at:
$ZTST_curline"
						return 1
					fi
					ZTST_getline
					found=1  ;;
				('<'*) ZTST_getredir || return 1
					found=1  ;;
				('*>'*) ZTST_curline=${ZTST_curline[2,-1]} 
					diff_out=p  ;&
				('>'*) ZTST_getredir || return 1
					found=1  ;;
				('*?'*) ZTST_curline=${ZTST_curline[2,-1]} 
					diff_err=p  ;&
				('?'*) ZTST_getredir || return 1
					found=1  ;;
				('F:'*) ZTST_failmsg="${ZTST_failmsg:+${ZTST_failmsg}
}  ${ZTST_curline[3,-1]}" 
					ZTST_getline
					found=1  ;;
				(*) ZTST_testfailed "bad line in test block:
$ZTST_curline"
					return 1 ;;
			esac
		done
		if [[ -n $ZTST_code ]]
		then
			ZTST_hashmark
			ZTST_verbose 1 "Running test: $ZTST_message"
			ZTST_verbose 2 "ZTST_test: expecting status: $ZTST_xstatus"
			ZTST_verbose 2 "Input: $ZTST_in, output: $ZTST_out, error: $ZTST_terr"
			ZTST_execchunk < $ZTST_in > $ZTST_tout 2> $ZTST_terr
			if [[ -n $ZTST_skip ]]
			then
				ZTST_verbose 0 "Test case skipped: $ZTST_skip"
				ZTST_skip= 
				if [[ -n $last ]]
				then
					break
				else
					continue
				fi
			fi
			if [[ $ZTST_xstatus != - && $ZTST_xstatus != $ZTST_status ]]
			then
				ZTST_testfailed "bad status $ZTST_status, expected $ZTST_xstatus from:
$ZTST_code${$(<$ZTST_terr):+
Error output:
$(<$ZTST_terr)}"
				return 1
			fi
			ZTST_verbose 2 "ZTST_test: test produced standard output:
$(<$ZTST_tout)
ZTST_test: and standard error:
$(<$ZTST_terr)"
			if [[ $ZTST_flags = *q* && -s $ZTST_out ]]
			then
				substlines="$(<$ZTST_out)" 
				rm -rf $ZTST_out
				print -r -- "${(e)substlines}" > $ZTST_out
			fi
			if [[ $ZTST_flags != *d* ]] && ! ZTST_diff $diff_out -c $ZTST_out $ZTST_tout
			then
				ZTST_testfailed "output differs from expected as shown above for:
$ZTST_code${$(<$ZTST_terr):+
Error output:
$(<$ZTST_terr)}"
				return 1
			fi
			if [[ $ZTST_flags = *q* && -s $ZTST_err ]]
			then
				substlines="$(<$ZTST_err)" 
				rm -rf $ZTST_err
				print -r -- "${(e)substlines}" > $ZTST_err
			fi
			if [[ $ZTST_flags != *D* ]] && ! ZTST_diff $diff_err -c $ZTST_err $ZTST_terr
			then
				ZTST_testfailed "error output differs from expected as shown above for:
$ZTST_code"
				return 1
			fi
		fi
		ZTST_verbose 1 "Test successful."
		[[ -n $last ]] && break
	done
	ZTST_verbose 2 "ZTST_test: all tests successful"
	ZTST_message='' 
}
ZTST_testfailed () {
	print -r "Test $ZTST_testname failed: $1"
	if [[ -n $ZTST_message ]]
	then
		print -r "Was testing: $ZTST_message"
	fi
	print -r "$ZTST_testname: test failed."
	if [[ -n $ZTST_failmsg ]]
	then
		print -r "The following may (or may not) help identifying the cause:
$ZTST_failmsg"
	fi
	ZTST_testfailed=1 
	return 1
}
ZTST_verbose () {
	local lev=$1 
	shift
	if [[ -n $ZTST_verbose && $ZTST_verbose -ge $lev ]]
	then
		print -r -u $ZTST_fd -- $*
	fi
}
scope00 () {
	typeset scalar
	scalar=local 
	typeset -a array
	array=(l o c a l) 
	print $scalar $array
}
scope01 () {
	local scalar
	scalar=local 
	local -a array
	array=(l o c a l) 
	print $scalar $array
}
scope02 () {
	declare scalar
	scalar=local 
	declare -a array
	array=(l o c a l) 
	print $scalar $array
}
scope10 () {
	export outer=outer 
	/gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh -fc 'echo $outer'
}
scope11 () {
	typeset -x outer=outer 
	/gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh -fc 'echo $outer'
}
scope12 () {
	local -x outer=inner 
	/gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh -fc 'echo $outer'
}
scope13 () {
	local -xT OUTER outer
	outer=(i n n e r) 
	/gnu/store/311nvir0pz1mhf0mgsmfrw00qfj7yq0j-bash-4.3.39/bin/sh -fc 'echo $OUTER'
}
stress00 () {
	typeset -h +g -m [[:alpha:]_]*
	unset -m [[:alpha:]_]*
	typeset +m [[:alpha:]_]*
}
tail () {
	emulate -L zsh
	if [[ -z $TAIL_SUPPORTS_MINUS_N ]]
	then
		local test
		test=$(echo "foo\nbar" | command tail -n 1 2>/dev/null) 
		if [[ $test = bar ]]
		then
			TAIL_SUPPORTS_MINUS_N=1 
		else
			TAIL_SUPPORTS_MINUS_N=0 
		fi
	fi
	integer argi=${argv[(i)-<->]} 
	if [[ $argi -le $# && $TAIL_SUPPORTS_MINUS_N = 1 ]]
	then
		argv[$argi]=(-n ${argv[$argi][2,-1]}) 
	fi
	command tail "$argv[@]"
}
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 readonly r=success
ZTST_getchunk: read code chunk:
 readonly r=success
 print $r
 r=failure
ZTST_test: examining line:
>success
ZTST_getredir: read redir for '>':
success
ZTST_test: examining line:
?(eval):3: read-only variable: r
ZTST_getredir: read redir for '?':
(eval):3: read-only variable: r
ZTST_test: examining line:

Running test: Readonly declaration
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:
success
ZTST_test: and standard error:
(eval):3: read-only variable: r
Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset r=success
ZTST_getchunk: read code chunk:
 typeset r=success
 readonly r
 print $r
 r=failure
ZTST_test: examining line:
>success
ZTST_getredir: read redir for '>':
success
ZTST_test: examining line:
?(eval):4: read-only variable: r
ZTST_getredir: read redir for '?':
(eval):4: read-only variable: r
ZTST_test: examining line:

Running test: Convert to readonly
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:
success
ZTST_test: and standard error:
(eval):4: read-only variable: r
Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -gU array
ZTST_getchunk: read code chunk:
 typeset -gU array
 print $array
ZTST_test: examining line:
>a r y
ZTST_getredir: read redir for '>':
a r y
ZTST_test: examining line:

Running test: Uniquified arrays and non-local scope
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
a r y
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -T SCALAR=l:o:c:a:l array
ZTST_getchunk: read code chunk:
 typeset -T SCALAR=l:o:c:a:l array
 print $array
 typeset -U SCALAR
 print $SCALAR $array
ZTST_test: examining line:
>l o c a l
ZTST_getredir: read redir for '>':
l o c a l
l:o:c:a l o c a
ZTST_test: examining line:

Running test: Tied parameters and uniquified colon-arrays
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
l o c a l
l:o:c:a l o c a
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 (setopt NO_multibyte cbases
ZTST_getchunk: read code chunk:
 (setopt NO_multibyte cbases
 LC_ALL=C 2>/dev/null
 typeset -T SCALAR=$'l\x83o\x83c\x83a\x83l' array $'\x83'
 print $array
 typeset -U SCALAR
 for (( i = 1; i <= ${#SCALAR}; i++ )); do
   char=$SCALAR[i]
   print $(( [#16] #char ))
 done
 print $array)
ZTST_test: examining line:
>l o c a l
ZTST_getredir: read redir for '>':
l o c a l
0x6C
0x83
0x6F
0x83
0x63
0x83
0x61
l o c a
ZTST_test: examining line:

Running test: Tied parameters and uniquified arrays with meta-character as separator
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
l o c a l
0x6C
0x83
0x6F
0x83
0x63
0x83
0x61
l o c a
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -T SCALAR=$'l\000o\000c\000a\000l' array $'\000'
ZTST_getchunk: read code chunk:
 typeset -T SCALAR=$'l\000o\000c\000a\000l' array $'\000'
 typeset -U SCALAR
 print $array
 [[ $SCALAR == $'l\000o\000c\000a' ]]
ZTST_test: examining line:
>l o c a
ZTST_getredir: read redir for '>':
l o c a
ZTST_test: examining line:

Running test: Tied parameters and uniquified arrays with NUL-character as separator
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
l o c a
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -T SCALAR array
ZTST_getchunk: read code chunk:
 typeset -T SCALAR array
 typeset +T SCALAR
ZTST_test: examining line:
?(eval):typeset:2: use unset to remove tied variables
ZTST_getredir: read redir for '?':
(eval):typeset:2: use unset to remove tied variables
ZTST_test: examining line:

Running test: Untying is prohibited
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:

ZTST_test: and standard error:
(eval):typeset:2: use unset to remove tied variables
Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 OUTER=outer
ZTST_getchunk: read code chunk:
 OUTER=outer
 scope13
 print $OUTER
ZTST_test: examining line:
>i:n:n:e:r
ZTST_getredir: read redir for '>':
i:n:n:e:r
outer
ZTST_test: examining line:

Running test: Export of tied parameters
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
i:n:n:e:r
outer
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -TU MORESTUFF=here-we-go-go-again morestuff '-'
ZTST_getchunk: read code chunk:
 typeset -TU MORESTUFF=here-we-go-go-again morestuff '-'
 print -l $morestuff
ZTST_test: examining line:
>here
ZTST_getredir: read redir for '>':
here
we
go
again
ZTST_test: examining line:

Running test: Tied arrays with separator specified
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
here
we
go
again
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -T THIS will not work
ZTST_getchunk: read code chunk:
 typeset -T THIS will not work
ZTST_test: examining line:
?(eval):typeset:1: too many arguments for -T
ZTST_getredir: read redir for '?':
(eval):typeset:1: too many arguments for -T
ZTST_test: examining line:

Running test: Tied array syntax
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:

ZTST_test: and standard error:
(eval):typeset:1: too many arguments for -T
Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 local array[2]=x
ZTST_getchunk: read code chunk:
 local array[2]=x
ZTST_test: examining line:
?(eval):local:1: array[2]: can't create local array elements
ZTST_getredir: read redir for '?':
(eval):local:1: array[2]: can't create local array elements
ZTST_test: examining line:

Running test: Illegal local array element assignment
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:

ZTST_test: and standard error:
(eval):local:1: array[2]: can't create local array elements
Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 local -a array
ZTST_getchunk: read code chunk:
 local -a array
 typeset array[1]=a array[2]=b array[3]=c
 print $array
ZTST_test: examining line:
>a b c
ZTST_getredir: read redir for '>':
a b c
ZTST_test: examining line:

Running test: Legal local array element assignment
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
a b c
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 local -A assoc
ZTST_getchunk: read code chunk:
 local -A assoc
 local b=1 ;: to stomp assoc[1] if assoc[b] is broken
 typeset assoc[1]=a assoc[b]=2 assoc[3]=c
 print $assoc[1] $assoc[b] $assoc[3]
ZTST_test: examining line:
>a 2 c
ZTST_getredir: read redir for '>':
a 2 c
ZTST_test: examining line:

Running test: Legal local associative array element assignment
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
a 2 c
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 local scalar scalar[1]=a scalar[2]=b scalar[3]=c
ZTST_getchunk: read code chunk:
 local scalar scalar[1]=a scalar[2]=b scalar[3]=c
 print $scalar
ZTST_test: examining line:
>abc
ZTST_getredir: read redir for '>':
abc
ZTST_test: examining line:

Running test: Local scalar subscript assignment
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
abc
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -L 10 fools
ZTST_getchunk: read code chunk:
 typeset -L 10 fools
 for fools in "   once" "twice"  "      thrice" "   oops too long here"; do
   print "'$fools'"
 done
ZTST_test: examining line:
>'once      '
ZTST_getredir: read redir for '>':
'once      '
'twice     '
'thrice    '
'oops too l'
ZTST_test: examining line:

Running test: Left justification of scalars
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'once      '
'twice     '
'thrice    '
'oops too l'
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -L 10 -F 3 foolf
ZTST_getchunk: read code chunk:
 typeset -L 10 -F 3 foolf
 for foolf in 1.3 4.6 -2.987 -4.91031; do
   print "'$foolf'"
 done
ZTST_test: examining line:
>'1.300     '
ZTST_getredir: read redir for '>':
'1.300     '
'4.600     '
'-2.987    '
'-4.910    '
ZTST_test: examining line:

Running test: Left justification of floating point
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'1.300     '
'4.600     '
'-2.987    '
'-4.910    '
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -L 10 -Z foolzs
ZTST_getchunk: read code chunk:
 typeset -L 10 -Z foolzs
 for foolzs in 001.3 04.6 -2.987 -04.91231; do
   print "'$foolzs'"
 done
ZTST_test: examining line:
>'1.3       '
ZTST_getredir: read redir for '>':
'1.3       '
'4.6       '
'-2.987    '
'-04.91231 '
ZTST_test: examining line:

Running test: Left justification of scalars with zero suppression
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'1.3       '
'4.6       '
'-2.987    '
'-04.91231 '
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -R 10 foors
ZTST_getchunk: read code chunk:
 typeset -R 10 foors
 for foors in short longer even-longer; do
   print "'$foors'"
 done
ZTST_test: examining line:
>'     short'
ZTST_getredir: read redir for '>':
'     short'
'    longer'
'ven-longer'
ZTST_test: examining line:

Running test: Right justification of scalars
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'     short'
'    longer'
'ven-longer'
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -Z 10 foozs
ZTST_getchunk: read code chunk:
 typeset -Z 10 foozs
 for foozs in 42 -42 " 43" " -43"; do
   print "'$foozs'"
 done
ZTST_test: examining line:
>'0000000042'
ZTST_getredir: read redir for '>':
'0000000042'
'       -42'
' 000000043'
'       -43'
ZTST_test: examining line:

Running test: Right justification of scalars with zeroes
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'0000000042'
'       -42'
' 000000043'
'       -43'
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 integer -Z 10 foozi
ZTST_getchunk: read code chunk:
 integer -Z 10 foozi
 for foozi in 42 -42 " 43" " -43"; do
   print "'$foozi'"
 done
ZTST_test: examining line:
>'0000000042'
ZTST_getredir: read redir for '>':
'0000000042'
'-000000042'
'0000000043'
'-000000043'
ZTST_test: examining line:

Running test: Right justification of integers with zero, no initial base
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'0000000042'
'-000000042'
'0000000043'
'-000000043'
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 unsetopt cbases
ZTST_getchunk: read code chunk:
 unsetopt cbases
 integer -Z 10 -i 16 foozi16
 for foozi16 in 42 -42 " 43" " -43"; do
   print "'$foozi16'"
 done
ZTST_test: examining line:
>'16#000002A'
ZTST_getredir: read redir for '>':
'16#000002A'
'-16#00002A'
'16#000002B'
'-16#00002B'
ZTST_test: examining line:

Running test: Right justification of integers with zero, base 16, C_BASES off
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'16#000002A'
'-16#00002A'
'16#000002B'
'-16#00002B'
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 setopt cbases
ZTST_getchunk: read code chunk:
 setopt cbases
 integer -Z 10 -i 16 foozi16c
 for foozi16c in 42 -42 " 43" " -43"; do
   print "'$foozi16c'"
 done
ZTST_test: examining line:
>'0x0000002A'
ZTST_getredir: read redir for '>':
'0x0000002A'
'-0x000002A'
'0x0000002B'
'-0x000002B'
ZTST_test: examining line:

Running test: Right justification of integers with zero, base 16, C_BASES on
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'0x0000002A'
'-0x000002A'
'0x0000002B'
'-0x000002B'
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 setopt cbases
ZTST_getchunk: read code chunk:
 setopt cbases
 integer -Z 10 -i 16 foozi16c
 for foozi16c in 0x1234 -0x1234; do
   for (( i = 1; i <= 5; i++ )); do
       print "'${foozi16c[i,11-i]}'"
   done
   print "'${foozi16c[-2]}'"
 done
ZTST_test: examining line:
>'0x00001234'
ZTST_getredir: read redir for '>':
'0x00001234'
'x0000123'
'000012'
'0001'
'00'
'3'
'-0x0001234'
'0x000123'
'x00012'
'0001'
'00'
'3'
ZTST_test: examining line:

Running test: Extracting substrings from padded integers
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'0x00001234'
'x0000123'
'000012'
'0001'
'00'
'3'
'-0x0001234'
'0x000123'
'x00012'
'0001'
'00'
'3'
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -F 3 -Z 10 foozf
ZTST_getchunk: read code chunk:
 typeset -F 3 -Z 10 foozf
 for foozf in 3.14159 -3.14159 4 -4; do
   print "'$foozf'"
 done
ZTST_test: examining line:
>'000003.142'
ZTST_getredir: read redir for '>':
'000003.142'
'-00003.142'
'000004.000'
'-00004.000'
ZTST_test: examining line:

Running test: Right justification of fixed point numbers with zero
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
'000003.142'
'-00003.142'
'000004.000'
'-00004.000'
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 stress00
ZTST_getchunk: read code chunk:
 stress00
 print $scalar $array
ZTST_test: examining line:
>scalar a r y
ZTST_getredir: read redir for '>':
scalar a r y
ZTST_test: examining line:

Running test: Stress test: all parameters are local and unset, using -m
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
scalar a r y
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 local parentenv=preserved
ZTST_getchunk: read code chunk:
 local parentenv=preserved
 fn() {
  typeset -h +g -m \*
  unset -m \*
  integer i=9
  float -H f=9
  declare -t scalar
  declare -H -a array
  typeset
  typeset +
 }
 fn
 echo $parentenv
ZTST_test: examining line:
>array local array
ZTST_getredir: read redir for '>':
array local array
float local f
integer local i=9
local tagged scalar=''
array local array
float local f
integer local i
local tagged scalar
preserved
ZTST_test: examining line:

Running test: Parameter hiding and tagging, printing types and values
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
array local array
float local f
integer local i=9
local tagged scalar=''
array local array
float local f
integer local i
local tagged scalar
preserved
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 export ENVFOO=bar
ZTST_getchunk: read code chunk:
 export ENVFOO=bar
 print ENVFOO in environment
 env | grep '^ENVFOO'
 print Changing ENVFOO
 ENVFOO="not bar any more"
 env | grep '^ENVFOO'
 unset ENVFOO
 print ENVFOO no longer in environment
 env | grep '^ENVFOO'
ZTST_test: examining line:
>ENVFOO in environment
ZTST_getredir: read redir for '>':
ENVFOO in environment
ENVFOO=bar
Changing ENVFOO
ENVFOO=not bar any more
ENVFOO no longer in environment
ZTST_test: examining line:

Running test: Adding and removing values to and from the environment
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:
ENVFOO in environment
ENVFOO=bar
Changing ENVFOO
ENVFOO=not bar any more
ENVFOO no longer in environment
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 (export FOOENV=BAR
ZTST_getchunk: read code chunk:
 (export FOOENV=BAR
 env | grep '^FOOENV'
 print Exec
 exec $ZTST_testdir/../Src/zsh -fc '
 print Unset
 unset FOOENV
 env | grep "^FOOENV"')
ZTST_test: examining line:
>FOOENV=BAR
ZTST_getredir: read redir for '>':
FOOENV=BAR
Exec
Unset
ZTST_test: examining line:

Running test: Can unset environment variables after exec
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:
FOOENV=BAR
Exec
Unset
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 local case1=upper
ZTST_getchunk: read code chunk:
 local case1=upper
 typeset -u case1
 print $case1
 upper="VALUE OF \$UPPER"
 print ${(P)case1}
ZTST_test: examining line:
>UPPER
ZTST_getredir: read redir for '>':
UPPER
VALUE OF $UPPER
ZTST_test: examining line:

Running test: Upper case conversion, does not apply to values used internally
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
UPPER
VALUE OF $UPPER
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 local case2=LOWER
ZTST_getchunk: read code chunk:
 local case2=LOWER
 typeset -l case2
 print $case2
 LOWER="value of \$lower"
 print ${(P)case2}
ZTST_test: examining line:
>lower
ZTST_getredir: read redir for '>':
lower
value of $lower
ZTST_test: examining line:

Running test: Lower case conversion, does not apply to values used internally
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
lower
value of $lower
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -a array
ZTST_getchunk: read code chunk:
 typeset -a array
 array=(foo bar)
 fn() { typeset -p array nonexistent; }
 fn
ZTST_test: examining line:
>typeset -a array
ZTST_getredir: read redir for '>':
typeset -a array
array=( foo bar )
ZTST_test: examining line:
?fn:typeset: no such variable: nonexistent
ZTST_getredir: read redir for '?':
fn:typeset: no such variable: nonexistent
ZTST_test: examining line:

Running test: declare -p shouldn't create scoped values
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:
typeset -a array
array=( foo bar )
ZTST_test: and standard error:
fn:typeset: no such variable: nonexistent
Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 unsetopt typesetsilent
ZTST_getchunk: read code chunk:
 unsetopt typesetsilent
 silent1(){ typeset -g silence; }
 silent2(){ local silence; silent1; }
 silent2
ZTST_test: examining line:

Running test: typeset -g should be silent even without TYPESET_SILENT
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:

ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 typeset -T TIED_SCALAR tied_array
ZTST_getchunk: read code chunk:
 typeset -T TIED_SCALAR tied_array
 TIED_SCALAR=foo:bar
 print $tied_array
 typeset -T TIED_SCALAR=goo:car tied_array
 print $tied_array
 typeset -T TIED_SCALAR tied_array=(poo par)
 print $TIED_SCALAR
ZTST_test: examining line:
>foo bar
ZTST_getredir: read redir for '>':
foo bar
goo car
poo:par
ZTST_test: examining line:

Running test: retying arrays to same array works
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
foo bar
goo car
poo:par
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
 (
ZTST_getchunk: read code chunk:
 (
   setopt POSIXBUILTINS
   readonly pbro
   print ${+pbro} >&2
   (typeset pbro=3)
   (pbro=4)
   readonly -p | grep pbro >&2  # shows up as "readonly" although unset
   typeset -r pbro        # idempotent (no error)...
   print ${+pbro} >&2     # ...so still readonly...
   typeset +r pbro        # ...can't turn it off
 )
ZTST_test: examining line:
?0
ZTST_getredir: read redir for '?':
0
(eval):5: read-only variable: pbro
(eval):6: read-only variable: pbro
typeset -r pbro
0
(eval):10: read-only variable: pbro
ZTST_test: examining line:

Running test: readonly with POSIX_BUILTINS
ZTST_test: expecting status: 1
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 1
ZTST_test: test produced standard output:

ZTST_test: and standard error:
0
(eval):5: read-only variable: pbro
(eval):6: read-only variable: pbro
typeset -r pbro
0
(eval):10: read-only variable: pbro
Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  readonly foo=bar novalue
ZTST_getchunk: read code chunk:
  readonly foo=bar novalue
  readonly -p
ZTST_test: examining line:
>typeset -r foo=bar
ZTST_getredir: read redir for '>':
typeset -r foo=bar
typeset -r novalue=''
ZTST_test: examining line:

Running test: readonly -p output (no readonly specials)
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
typeset -r foo=bar
typeset -r novalue=''
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  local -a a1 a2
ZTST_getchunk: read code chunk:
  local -a a1 a2
  local -r r1=yes r2=no
  a1=(one two) a2=(three four)
  readonly a1
  typeset -pm 'a[12]'
  typeset -pm 'r[12]'
ZTST_test: examining line:
>typeset -a a1
ZTST_getredir: read redir for '>':
typeset -a a1
a1=( one two )
typeset -ar a1
typeset -a a2
a2=( three four )
typeset -r r1=yes
typeset -r r2=no
ZTST_test: examining line:

Running test: readonly -p output
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
typeset -a a1
a1=( one two )
typeset -ar a1
typeset -a a2
a2=( three four )
typeset -r r1=yes
typeset -r r2=no
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  one=hidden two=hidden three=hidden four=hidden five=hidden
ZTST_getchunk: read code chunk:
  one=hidden two=hidden three=hidden four=hidden five=hidden
  fn() {
     local bleugh="four=vier"
     typeset -R10 one=eins two=(zwei dio) three $bleugh five=(cinq cinque)
     three=drei
     print -l $one $two $three $four $five
  }
  fn
  print -l $one $two $three $four $five
ZTST_test: examining line:
>      eins
ZTST_getredir: read redir for '>':
      eins
zwei
dio
      drei
      vier
cinq
cinque
hidden
hidden
hidden
hidden
hidden
ZTST_test: examining line:

Running test: typeset reserved word interface: basic
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
      eins
zwei
dio
      drei
      vier
cinq
cinque
hidden
hidden
hidden
hidden
hidden
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  (
ZTST_getchunk: read code chunk:
  (
  setopt glob
  mkdir -p arrayglob
  touch arrayglob/{one,two,three,four,five,six,seven}
  fn() {
    typeset array=(arrayglob/[tf]*)
    print -l ${array:t}
    #
    typeset {first,second,third}=the_same_value array=(
    extends
    over
    multiple
    lines
    )
    print -l $first $second $third "$array"
    #
    integer i=$(echo 1 + 2 + 3 + 4)
    print $i
    #
    # only noted by accident this was broken..
    # we need to turn off special recognition
    # of assignments within assignments...
    typeset careful=( i=1 j=2 k=3 )
    print -l $careful
  }
  fn
  )
ZTST_test: examining line:
>five
ZTST_getredir: read redir for '>':
five
four
three
two
the_same_value
the_same_value
the_same_value
extends over multiple lines
10
i=1
j=2
k=3
ZTST_test: examining line:

Running test: typeset reserved word, more complicated cases
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
five
four
three
two
the_same_value
the_same_value
the_same_value
extends over multiple lines
10
i=1
j=2
k=3
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  (
ZTST_getchunk: read code chunk:
  (
     # reserved word is recognised at parsing.
     # yes, this is documented.
     # anyway, that means we need to
     # re-eval the function...
     fn='
     fn() {
        typeset foo=`echo one word=two`
        print $foo
        print $word
     }
     '
     print reserved
     eval $fn; fn
     print builtin
     disable -r typeset
     eval $fn; fn
     enable -r typeset
     disable typeset
     print reserved
     eval $fn; fn
  )
ZTST_test: examining line:
>reserved
ZTST_getredir: read redir for '>':
reserved
one word=two

builtin
one
two
reserved
one word=two

ZTST_test: examining line:

Running test: reserved word and builtin interfaces
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
reserved
one word=two

builtin
one
two
reserved
one word=two
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  fn() {
ZTST_getchunk: read code chunk:
  fn() {
    emulate -L zsh
    setopt typeset_silent
    local k
    typeset -A hash=(k1 v1 k2 v2)
    typeset foo=word array=(more than one word)
    for k in ${(ko)hash}; do
      print $k $hash[$k]
    done
    print -l $foo $array
    typeset -A hash
    typeset foo array
    for k in ${(ko)hash}; do
      print $k $hash[$k]
    done
    print -l $foo $array
    typeset hash=(k3 v3 k4 v4) array=(odd number here)
    for k in ${(ko)hash}; do
      print $k $hash[$k]
    done
    print -l $array
  }
  fn
ZTST_test: examining line:
>k1 v1
ZTST_getredir: read redir for '>':
k1 v1
k2 v2
word
more
than
one
word
k1 v1
k2 v2
word
more
than
one
word
k3 v3
k4 v4
odd
number
here
ZTST_test: examining line:

Running test: typeset preserves existing variable types
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
k1 v1
k2 v2
word
more
than
one
word
k1 v1
k2 v2
word
more
than
one
word
k3 v3
k4 v4
odd
number
here
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  fn() { typeset foo bar thing=this stuff=(that other) more=woevva; }
ZTST_getchunk: read code chunk:
  fn() { typeset foo bar thing=this stuff=(that other) more=woevva; }
  which -x2 fn
  fn2() { typeset assignfirst=(why not); }
  which -x2 fn2
ZTST_test: examining line:
>fn () {
ZTST_getredir: read redir for '>':
fn () {
  typeset foo bar thing=this stuff=(that other) more=woevva 
}
fn2 () {
  typeset assignfirst=(why not) 
}
ZTST_test: examining line:

Running test: text output from typeset
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
fn () {
  typeset foo bar thing=this stuff=(that other) more=woevva 
}
fn2 () {
  typeset assignfirst=(why not) 
}
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  fn() {
ZTST_getchunk: read code chunk:
  fn() {
    typeset array=()
    print ${(t)array} ${#array}
    typeset gnothergarray=() gnothergarray[1]=yes gnothergarray[2]=no
    print -l ${(t)gnothergarray} $gnothergarray
  }
  fn
ZTST_test: examining line:
>array-local 0
ZTST_getredir: read redir for '>':
array-local 0
array-local
yes
no
ZTST_test: examining line:

Running test: can set empty array
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
array-local 0
array-local
yes
no
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  array=(nothing to see here)
ZTST_getchunk: read code chunk:
  array=(nothing to see here)
  fn() {
    typeset array=(one two three four five)
    typeset array[2,4]=(umm er)
    print ${#array} $array
    typeset array[2,3]=()
    print ${#array} $array
  }
  fn
  print ${#array} $array
ZTST_test: examining line:
>4 one umm er five
ZTST_getredir: read redir for '>':
4 one umm er five
2 one five
4 nothing to see here
ZTST_test: examining line:

Running test: can update array slices in typeset
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
4 one umm er five
2 one five
4 nothing to see here
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: examining line:
  array=(no really nothing here)
ZTST_getchunk: read code chunk:
  array=(no really nothing here)
  fn() {
    typeset array=() array[2]=two array[4]=four
    typeset -p array
    typeset array=() array[3]=three array[1]=one
    typeset -p array
  }
  fn
  print $array
ZTST_test: examining line:
>typeset -a array
ZTST_getredir: read redir for '>':
typeset -a array
array=( '' two '' four )
typeset -a array
array=( one '' three )
no really nothing here
ZTST_test: examining line:

Running test: setting empty array in typeset
ZTST_test: expecting status: 0
Input: /tmp/zsh.ztst.in.18963, output: /tmp/zsh.ztst.out.18963, error: /tmp/zsh.ztst.terr.18963
ZTST_execchunk: status 0
ZTST_test: test produced standard output:
typeset -a array
array=( '' two '' four )
typeset -a array
array=( one '' three )
no really nothing here
ZTST_test: and standard error:

Test successful.
ZTST_test: looking for new test
ZTST_test: examining line:

ZTST_test: all tests successful
./ztst.zsh:540: parse error near `*'
./B03print.ztst: starting.