summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
Diffstat (limited to 'Test')
-rw-r--r--Test/B01cd.ztst8
-rw-r--r--Test/C03traps.ztst17
-rw-r--r--Test/D02glob.ztst18
-rw-r--r--Test/D04parameter.ztst95
-rw-r--r--Test/X04zlehighlight.ztst2
-rw-r--r--Test/Y01completion.ztst9
-rwxr-xr-xTest/list-XFails5
-rwxr-xr-xTest/ztst.zsh30
8 files changed, 176 insertions, 8 deletions
diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst
index 6a5308259..3312f8707 100644
--- a/Test/B01cd.ztst
+++ b/Test/B01cd.ztst
@@ -53,7 +53,7 @@
# stderr.
#
# The rules for '<', '>' and '?' lines are the same: only the first
-# character is stripped (with the excpetion for '*' noted below), with
+# character is stripped (with the exception for '*' noted below), with
# subsequent whitespace being significant; lines are not subject to any
# substitution unless the `q' flag (see below) is set.
#
@@ -70,11 +70,13 @@
# the expected status returned by the code when run, or - if it is
# irrelevant. An optional set of single-letter flags follows the status
# or -. The following are understood:
-# . d Don't diff stdout against the expected stdout.
+# . d Don't diff stdout against the expected stdout.
# D Don't diff stderr against the expected stderr.
# q All redirection lines given in the test script (not the lines
# actually produced by the test) are subject to ordinary quoted shell
# expansion (i.e. not globbing).
+# f Test is expected to fail. If the test's exit code, stdout, and stderr
+# match, report a problem; otherwise, carry on to the next test case.
# This can be followed by a `:' and a message describing the
# test, which will be printed if the test fails, along with a
# description of the failure that occurred. The `:' and message are
@@ -106,7 +108,7 @@
# ZTST_skip: Set this in any test case if that single test case is to be
# skipped. Testing resumes at the next test case in the same file.
#
-# Syntax highlighting for Vim is available, see Util/ztst.vim.
+# Syntax highlighting for Vim is available, see Util/ztst-*.vim.
cd cdtst.tmp/sub/fake &&
pwd &&
print $PWD
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 4aebd92b7..e661aabd5 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -881,6 +881,23 @@ F:Must be tested with a top-level script rather than source or function
$ZTST_testdir/../Src/zsh -f <<<'fn() { exit 0; }; trap fn EXIT; false'
0:Explicit exit status overrides implicit: script-like code path
+ $ZTST_testdir/../Src/zsh -f <<<$'
+ trap \'echo $1; exit; echo $2\' USR1
+ fn() {
+ echo fn1
+ kill -s USR1 $$
+ echo fn2
+ }
+ echo out1
+ fn trap1 trap2
+ echo out2
+ '
+-f:(workers/44007) function execution continues after 'exit' in trap
+>out1
+>fn1
+>trap1
+# As of 5.7.1-test-2, the output was "out1 fn1 trap1 fn2" (on separate lines).
+
%clean
rm -f TRAPEXIT
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 5638e1255..3d7df94c9 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -728,3 +728,21 @@
>does/not/exist
>not/exist
>exist
+
+ mkdir -m 000 glob.tmp/secret-d000
+ mkdir -m 111 glob.tmp/secret-d111
+ mkdir -m 444 glob.tmp/secret-d444
+ for 1 in 000 111 444 ; do ln -s secret-d$1 glob.tmp/secret-s$1; done
+ print -rC 2 -- glob.tmp/secret-*/ glob.tmp/secret-*(-/)
+-f:unreadable directories can be globbed (users/24619, users/24626)
+>glob.tmp/secret-d000/ glob.tmp/secret-d000
+>glob.tmp/secret-d111/ glob.tmp/secret-d111
+>glob.tmp/secret-d444/ glob.tmp/secret-d444
+>glob.tmp/secret-s000/ glob.tmp/secret-s000
+>glob.tmp/secret-s111/ glob.tmp/secret-s111
+>glob.tmp/secret-s444/ glob.tmp/secret-s444
+
+%clean
+
+ # Fix unreadable-directory permissions so ztst can clean up properly
+ chmod +rwx glob.tmp/secret-*(N) 2> /dev/null
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index c91af1a9c..76f3e77a1 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -640,6 +640,74 @@
>echo
>$(|||) bar
+ argv=(
+ $'a=() b=()'
+ $'a=(foo) b=(bar)'
+ $'a=(foo) b=() c=() d=(bar) e=(baz) f=() g=()'
+ $'a=(foo) b=() c=() d=(bar)\ne=(baz) f=() g=()'
+ $'a=(foo) b=() d=(bar)'
+ )
+ for 1; print -rl -- ${(z)1} && print
+0:${(z)} regression test: multiple array assignments
+>a=(
+>)
+>b=(
+>)
+>
+>a=(
+>foo
+>)
+>b=(
+>bar
+>)
+>
+>a=(
+>foo
+>)
+>b=(
+>)
+>c=(
+>)
+>d=(
+>bar
+>)
+>e=(
+>baz
+>)
+>f=(
+>)
+>g=(
+>)
+>
+>a=(
+>foo
+>)
+>b=(
+>)
+>c=(
+>)
+>d=(
+>bar
+>)
+>;
+>e=(
+>baz
+>)
+>f=(
+>)
+>g=(
+>)
+>
+>a=(
+>foo
+>)
+>b=(
+>)
+>d=(
+>bar
+>)
+>
+
foo=$'\x06ZUI\x1f text-field example: \x1azuitfieldtfield1_1\x1a\'\'\x1a\'\'\x1a1\x1aZUI\\[my_tfield1_width\\]\x1aZUI\\[my_tfield1_start\\]\x1aZUI\\[my_tfield1_data\\]\x1c'
print "${#${(z@)foo}}"
0:Test real-world data that once seemed to fail
@@ -2444,7 +2512,7 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
local -a x
: <<< ${(F)x/y}
}
-0:Separation / join logic regresssion test
+0:Separation / join logic regression test
testpath=/one/two/three/four
for (( i = 0; i <= 6; ++i )); do
@@ -2557,3 +2625,28 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
print ${foo%%*}
0:Largest match at end matches entire string
>
+
+ foo=pws
+ print 1: ${(S)foo#*}
+ print 2: ${(S)foo##*}
+ print 3: ${(S)foo#?}
+ print 4: ${(S)foo##?}
+0:(S) with zero-length matches at start
+>1: pws
+>2:
+>3: ws
+>4: ws
+
+ foo=pws
+ print 2: ${(S)foo%%*}
+0:(S) with zero-length matches at end, part 1 (workers/45164)
+>2: pws
+
+ foo=pws
+ print 1: ${(S)foo%*}
+ print 3: ${(S)foo%?}
+ print 4: ${(S)foo%%?}
+0:(S) with zero-length matches at end, part 2
+>1: pws
+>3: pw
+>4: pw
diff --git a/Test/X04zlehighlight.ztst b/Test/X04zlehighlight.ztst
index 000949698..475a2e309 100644
--- a/Test/X04zlehighlight.ztst
+++ b/Test/X04zlehighlight.ztst
@@ -157,5 +157,3 @@
%clean
zmodload -ui zsh/zpty
-
-# vim:ft=zsh
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 7ef319f7b..51f604bcf 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -216,6 +216,15 @@ F:regression test workers/31611
>NO:{3pm}
>NO:{10pm}
+ comptest $'a=() b=(\t'
+0:multiple envarrays
+>line: {a=() b=(}{}
+>DESCRIPTION:{file}
+>DI:{dir1}
+>DI:{dir2}
+>FI:{file1}
+>FI:{file2}
+
%clean
zmodload -ui zsh/zpty
diff --git a/Test/list-XFails b/Test/list-XFails
new file mode 100755
index 000000000..8d94a3d04
--- /dev/null
+++ b/Test/list-XFails
@@ -0,0 +1,5 @@
+#!/bin/sh
+# This script lists tests that are currently expected to fail. (I.e., tests
+# for bugs that haven't been fixed yet.)
+
+grep --color -E -n '^[-0-9.dDqf]*f[-0-9.dDqf]*:' -- "$(dirname -- "$0")"/*.ztst
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index a4c625230..375efd16c 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -366,6 +366,7 @@ ZTST_test() {
local last match mbegin mend found substlines
local diff_out diff_err
local ZTST_skip
+ integer expected_to_fail
while true; do
rm -f $ZTST_in $ZTST_out $ZTST_err
@@ -460,8 +461,21 @@ $ZTST_curline"
fi
fi
+ if [[ $ZTST_flags = *f* ]]; then
+ expected_to_fail=1
+ ZTST_xfail_diff() { ZTST_diff "$@" > /dev/null }
+ ZTST_diff=ZTST_xfail_diff
+ else
+ expected_to_fail=0
+ ZTST_diff=ZTST_diff
+ fi
+
# First check we got the right status, if specified.
if [[ $ZTST_xstatus != - && $ZTST_xstatus != $ZTST_status ]]; then
+ if (( expected_to_fail )); then
+ ZTST_verbose 1 "Test failed, as expected."
+ continue
+ fi
ZTST_testfailed "bad status $ZTST_status, expected $ZTST_xstatus from:
$ZTST_code${$(<$ZTST_terr):+
Error output:
@@ -480,7 +494,11 @@ $(<$ZTST_terr)"
rm -rf $ZTST_out
print -r -- "${(e)substlines}" >$ZTST_out
fi
- if [[ $ZTST_flags != *d* ]] && ! ZTST_diff $diff_out -u $ZTST_out $ZTST_tout; then
+ if [[ $ZTST_flags != *d* ]] && ! $ZTST_diff $diff_out -u $ZTST_out $ZTST_tout; then
+ if (( expected_to_fail )); then
+ ZTST_verbose 1 "Test failed, as expected."
+ continue
+ fi
ZTST_testfailed "output differs from expected as shown above for:
$ZTST_code${$(<$ZTST_terr):+
Error output:
@@ -492,11 +510,19 @@ $(<$ZTST_terr)}"
rm -rf $ZTST_err
print -r -- "${(e)substlines}" >$ZTST_err
fi
- if [[ $ZTST_flags != *D* ]] && ! ZTST_diff $diff_err -u $ZTST_err $ZTST_terr; then
+ if [[ $ZTST_flags != *D* ]] && ! $ZTST_diff $diff_err -u $ZTST_err $ZTST_terr; then
+ if (( expected_to_fail )); then
+ ZTST_verbose 1 "Test failed, as expected."
+ continue
+ fi
ZTST_testfailed "error output differs from expected as shown above for:
$ZTST_code"
return 1
fi
+ if (( expected_to_fail )); then
+ ZTST_testfailed "test was expected to fail, but passed."
+ return 1
+ fi
fi
ZTST_verbose 1 "Test successful."
[[ -n $last ]] && break