1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-27 22:40:20 +02:00

Third time's a charm: a better fix than using either a subshell or

"setopt localoptions" is to use a function for the final test (since
it destroys all the variables in the environment).  This allows us to
directly test that the environment was properly restored after the
function call, and ensures that the caller (ZTST_execchunk, which
directly exec'ed the test code) still has all the vars that it expects
in the environment (such as ZTST_verbose, options, and ZTST_mainopts).
This commit is contained in:
Wayne Davison 2005-08-11 16:25:10 +00:00
parent 0e57f6ebe8
commit 5aa648a5f2

View File

@ -23,7 +23,7 @@
%prep
setopt localoptions noglob
setopt noglob
scalar=scalar
array=(a r r a y)
@ -341,16 +341,21 @@
0q:Stress test: all parameters are local and unset, using -m
>scalar a r y
# The first declare works around the "not an identifier" bug with -h
declare \! \# \$ \* - \? @ 0
typeset -h +g -m \*
unset -m \*
integer i=9
float -H f=9
declare -t scalar
declare -H -a array
typeset
typeset +
local parentenv=preserved
fn() {
# The first declare works around the "not an identifier" bug with -h
declare \! \# \$ \* - \? @ 0
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
0:Parameter hiding and tagging, printing types and values
>array local array
>float local f
@ -360,3 +365,4 @@
>float local f
>integer local i
>local tagged scalar
>preserved