summaryrefslogtreecommitdiffstats
path: root/Test
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@ipost.com>2020-12-09 21:32:36 -0800
committerBart Schaefer <schaefer@ipost.com>2021-04-13 21:18:35 -0700
commit3099e79d25cd1cb1f718a060eadb4bb55080d816 (patch)
treefeb661623c9838521ba90d764567532651ed7108 /Test
parentFinal repairs for declared state of tied arrays (diff)
downloadzsh-3099e79d25cd1cb1f718a060eadb4bb55080d816.tar
zsh-3099e79d25cd1cb1f718a060eadb4bb55080d816.tar.gz
zsh-3099e79d25cd1cb1f718a060eadb4bb55080d816.tar.bz2
zsh-3099e79d25cd1cb1f718a060eadb4bb55080d816.tar.lz
zsh-3099e79d25cd1cb1f718a060eadb4bb55080d816.tar.xz
zsh-3099e79d25cd1cb1f718a060eadb4bb55080d816.tar.zst
zsh-3099e79d25cd1cb1f718a060eadb4bb55080d816.zip
Make DECLAREDNULL require POSIXBUILTINS and introduce a new test file.
V10private has been made agnostic to POSIXBUILTINS.
Diffstat (limited to 'Test')
-rw-r--r--Test/E03posix.ztst105
1 files changed, 105 insertions, 0 deletions
diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
new file mode 100644
index 000000000..5e6eddeba
--- /dev/null
+++ b/Test/E03posix.ztst
@@ -0,0 +1,105 @@
+# Test POSIX-specific behavior
+# Currently this covers only POSIXBUILTINS, other behaviors are in their
+# more directly related sections
+#
+
+%prep
+ setopt POSIX_BUILTINS
+
+%test
+
+ 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
+0:Parameter hiding and tagging, printing types and values
+>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
+
+ readonly foo=bar novalue
+ readonly -p
+0:readonly -p output (no readonly specials)
+>readonly foo=bar
+>readonly novalue
+
+ local -a myarray
+ typeset -p1 myarray
+ myarray=("&" sand '""' "" plugh)
+ typeset -p1 myarray
+0:typeset -p1 output for array
+>typeset -a myarray
+>typeset -a myarray=(
+> '&'
+> sand
+> '""'
+> ''
+> plugh
+>)
+
+ local -A myhash
+ typeset -p1 myhash
+ myhash=([one]=two [three]= [four]="[]")
+ typeset -p1 myhash
+0:typeset -p1 output for associative array
+>typeset -A myhash
+>typeset -A myhash=(
+> [four]='[]'
+> [one]=two
+> [three]=''
+>)
+
+ str=s
+ arr=(a)
+ typeset -A ass
+ ass=(a a)
+ integer i=0
+ float f=0
+ print ${(t)str} ${(t)arr} ${(t)ass} ${(t)i} ${(t)f}
+0:${(t)...}
+>scalar array association-local integer-local float-local
+
+ print $empty[(i)] $empty[(I)]
+0:(i) and (I) return nothing for empty array
+>
+
+ (
+ # reserved words are handled during parsing,
+ # hence eval...
+ disable -r typeset
+ eval '
+ setopt kshtypeset
+ ktvars=(ktv1 ktv2)
+ typeset ktfoo=`echo arg1 arg2` $ktvars
+ () {
+ local ktfoo
+ print $+ktv1 $+ktv2 $+ktv3 $+ktfoo
+ }
+ print $ktfoo
+ unsetopt kshtypeset
+ typeset noktfoo=`echo noktarg1 noktarg2`
+ print $noktfoo
+ print $+noktarg1 $+noktarg2
+ unset ktfoo ktv1 ktv2 noktfoo noktarg2
+ '
+ )
+0:KSH_TYPESET option
+>0 0 0 0
+>arg1 arg2
+>noktarg1
+>0 0