summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2015-11-26 21:14:04 +0100
committerAxel Beckert <abe@deuxchevaux.org>2015-11-26 21:14:04 +0100
commitd62e937278a04b2cc8d4dde8be9562b9f10b068c (patch)
tree9ed62f2ee69f3231b0da25c69b420f3830f0fb3f /Test
parente439a99f592f80729d28f5b2f6f3fbb012a3fd9d (diff)
parent78abc72f64b03d675922f9a958fdf5d6aa32ab67 (diff)
downloadzsh-d62e937278a04b2cc8d4dde8be9562b9f10b068c.tar.gz
zsh-d62e937278a04b2cc8d4dde8be9562b9f10b068c.zip
Merge tag '5.1.1-test-2' into debian
Second test version prior to 5.2 release.
Diffstat (limited to 'Test')
-rw-r--r--Test/B01cd.ztst14
-rw-r--r--Test/B09hash.ztst71
-rw-r--r--Test/C02cond.ztst18
-rw-r--r--Test/D07multibyte.ztst2
-rw-r--r--Test/V01zmodload.ztst6
-rw-r--r--Test/V02zregexparse.ztst4
-rw-r--r--Test/V03mathfunc.ztst5
-rw-r--r--Test/V04features.ztst3
-rw-r--r--Test/V05styles.ztst4
-rw-r--r--Test/V09datetime.ztst22
-rw-r--r--Test/V10private.ztst10
-rw-r--r--Test/X02zlevi.ztst2
-rw-r--r--Test/Y01completion.ztst2
-rw-r--r--Test/Y02compmatch.ztst2
-rw-r--r--Test/Y03arguments.ztst2
-rw-r--r--Test/comptest2
-rwxr-xr-xTest/ztst.zsh2
17 files changed, 124 insertions, 47 deletions
diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst
index a5b3769f1..94447e717 100644
--- a/Test/B01cd.ztst
+++ b/Test/B01cd.ztst
@@ -57,13 +57,13 @@
# subsequent whitespace being significant; lines are not subject to any
# substitution unless the `q' flag (see below) is set.
#
-# The first line (only) of a '>' and '?' chunk may be preceded by a '*',
-# so the line starts '*>' or '*?'. This signifies that all lines in the
-# chunk (not just the one with the '*' in front) in the actual output
-# are pattern matched against the corresponding lines in the test
-# output. Each line following '>' or '?' must be a valid pattern, so
-# characters special to patterns such as parentheses must be quoted
-# with a backslash. The EXTENDED_GLOB option is used for all such patterns.
+# Each line of a '>' and '?' chunk may be preceded by a '*', so the line
+# starts '*>' or '*?'. This signifies that for any line with '*' in front
+# the actual output should be pattern matched against the corresponding
+# lines in the test output. Each line following '>' or '?' must be a
+# valid pattern, so characters special to patterns such as parentheses
+# must be quoted with a backslash. The EXTENDED_GLOB option is used for
+# all such patterns.
#
# Each chunk of indented code is to be evaluated in one go and is to
# be followed by a line starting (in the first column) with
diff --git a/Test/B09hash.ztst b/Test/B09hash.ztst
new file mode 100644
index 000000000..49f304838
--- /dev/null
+++ b/Test/B09hash.ztst
@@ -0,0 +1,71 @@
+# The hash builtin is most used for the command hash table, which is
+# populated automatically. This is therefore highly system specific,
+# so mostly we'll test with the directory hash table: the logic is
+# virtually identical but with the different table, and furthermore
+# the shell doesn't care whether the directory exists unless you refer
+# to it in a context that needs one.
+
+%prep
+ populate_hash() {
+ hash -d one=/first/directory
+ hash -d two=/directory/the/second
+ hash -d three=/noch/ein/verzeichnis
+ hash -d four=/bored/with/this/now
+ }
+
+%test
+
+ hash -d
+0:Directory hash initially empty
+
+ populate_hash
+ hash -d
+0:Populating directory hash and output with sort
+>four=/bored/with/this/now
+>one=/first/directory
+>three=/noch/ein/verzeichnis
+>two=/directory/the/second
+
+ hash -rd
+ hash -d
+0:Empty hash
+
+ populate_hash
+ hash -d
+0:Refill hash
+>four=/bored/with/this/now
+>one=/first/directory
+>three=/noch/ein/verzeichnis
+>two=/directory/the/second
+
+ hash -dL
+0:hash -L option
+>hash -d four=/bored/with/this/now
+>hash -d one=/first/directory
+>hash -d three=/noch/ein/verzeichnis
+>hash -d two=/directory/the/second
+
+ hash -dm 't*'
+0:hash -m option
+>three=/noch/ein/verzeichnis
+>two=/directory/the/second
+
+ hash -d five=/yet/more six=/here/we/go seven=/not/yet/eight
+ hash -d
+0:Multiple assignments
+>five=/yet/more
+>four=/bored/with/this/now
+>one=/first/directory
+>seven=/not/yet/eight
+>six=/here/we/go
+>three=/noch/ein/verzeichnis
+>two=/directory/the/second
+
+ hash -d one two three
+0:Multiple arguments with no assignment not in verbose mode
+
+ hash -vd one two three
+0:Multiple arguments with no assignment in verbose mode
+>one=/first/directory
+>two=/directory/the/second
+>three=/noch/ein/verzeichnis
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index e9a596a22..40bbf424a 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -257,7 +257,7 @@ F:Failures in these cases do not indicate a problem in the shell.
>status = 1
# core dumps on failure
- if zmodload -i zsh/regex 2>/dev/null; then
+ if zmodload zsh/regex 2>/dev/null; then
echo >regex_test.sh 'if [[ $# = 1 ]]; then
if [[ $1 =~ /?[^/]+:[0-9]+:$ ]]; then
:
@@ -268,7 +268,8 @@ F:Failures in these cases do not indicate a problem in the shell.
fi
0:regex tests shouldn't crash
- (if zmodload -i zsh/regex 2>/dev/null; then
+ if zmodload zsh/regex 2>/dev/null; then
+ ( # subshell in case coredump test failed
string="this has stuff in it"
bad_regex=0
if [[ $string =~ "h([a-z]*) s([a-z]*) " ]]; then
@@ -295,23 +296,26 @@ F:Failures in these cases do not indicate a problem in the shell.
else
print -r "regex failed to match '$string'"
fi
+ )
else
# if it didn't load, tough, but not a test error
- print OK
- fi)
+ ZTST_skip="regexp library not found."
+ fi
0:MATCH, MBEGIN, MEND, match, mbegin, mend
>OK
- (if zmodload -i zsh/regex 2>/dev/null; then
+ if zmodload zsh/regex 2>/dev/null; then
+ ( # subshell because regex module may dump core, see above
if [[ a =~ a && b == b ]]; then
print OK
else
print "regex =~ inverted following test"
fi
+ )
else
# not a test error
- print OK
- fi)
+ ZTST_skip="regexp library not found."
+ fi
0:regex infix operator should not invert following conditions
>OK
diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
index dff2ec12f..f95c06d9a 100644
--- a/Test/D07multibyte.ztst
+++ b/Test/D07multibyte.ztst
@@ -500,7 +500,7 @@
# aren't quite double width, but the arithmetic is correct.
# It appears just to be an effect of the font.
- if zmodload -i zsh/regex 2>/dev/null; then
+ if zmodload zsh/regex 2>/dev/null; then
[[ $'\ua0' =~ '^.$' ]] && print OK
[[ $'\ua0' =~ $'^\ua0$' ]] && print OK
[[ $'\ua0'X =~ '^X$' ]] || print OK
diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst
index 3580bacea..349ae9c89 100644
--- a/Test/V01zmodload.ztst
+++ b/Test/V01zmodload.ztst
@@ -52,7 +52,7 @@
>zmodload zsh/main
>zmodload zsh/parameter
-# You use to need zmodload -i to avoid an error.
+# You used to need zmodload -i to avoid an error.
# That has been deemed pointless, so now an attempt
# to load a loaded module should succeed.
zmodload zsh/main
@@ -64,7 +64,7 @@
for m in $mods
do
- zmodload -i $m || mods[(r)$m]=()
+ zmodload $m || mods[(r)$m]=()
done
0d:Test loading of all compiled modules
@@ -74,7 +74,7 @@
# Now check for proper failure conditions by trying some operations on
# a nonexistent module.
- zmodload -i bogus/notamodule
+ zmodload bogus/notamodule
1D:Check that loading a nonexistent module fails
zmodload -u bogus/notamodule
diff --git a/Test/V02zregexparse.ztst b/Test/V02zregexparse.ztst
index ddca3c903..b4cec424e 100644
--- a/Test/V02zregexparse.ztst
+++ b/Test/V02zregexparse.ztst
@@ -2,7 +2,9 @@
%prep
- zmodload zsh/zutil
+ if ! zmodload zsh/zutil 2>/dev/null; then
+ ZTST_unimplemented="can't load the zsh/zutil module for testing"
+ fi
%test
diff --git a/Test/V03mathfunc.ztst b/Test/V03mathfunc.ztst
index ab383db43..1edb7a279 100644
--- a/Test/V03mathfunc.ztst
+++ b/Test/V03mathfunc.ztst
@@ -1,9 +1,7 @@
# Tests for the module zsh/mathfunc
%prep
- if ( zmodload -i zsh/mathfunc ) >/dev/null 2>&1; then
- zmodload -i zsh/mathfunc
- else
+ if ! zmodload zsh/mathfunc 2>/dev/null; then
ZTST_unimplemented="The module zsh/mathfunc is not available."
fi
@@ -112,7 +110,6 @@ F:This test fails if your math library doesn't have erand48().
float -F f sum sumsq max max2 av sd
typeset -a randoms
randoms=('f = RANDOM' 'f = rand48()')
- zmodload -i zsh/mathfunc
for isource in 1 2; do
(( sum = sumsq = max = 0 ))
repeat $N; do
diff --git a/Test/V04features.ztst b/Test/V04features.ztst
index 2790456e2..6939053e1 100644
--- a/Test/V04features.ztst
+++ b/Test/V04features.ztst
@@ -7,7 +7,8 @@
# We use zsh/datetime because it has a list of features that is short
# but contains two types.
- if ! (zmodload zsh/datetime >/dev/null 2>/dev/null); then
+ # Subshell for prep test so we can load individual features later
+ if ! (zmodload zsh/datetime 2>/dev/null); then
ZTST_unimplemented="can't load the zsh/datetime module for testing"
fi
diff --git a/Test/V05styles.ztst b/Test/V05styles.ztst
index e932b5474..ca95b6348 100644
--- a/Test/V05styles.ztst
+++ b/Test/V05styles.ztst
@@ -2,9 +2,7 @@
# Test the use of styles, if the zsh/zutil module is available.
- if (zmodload zsh/zutil >/dev/null 2>/dev/null); then
- zmodload zsh/zutil
- else
+ if ! zmodload zsh/zutil 2>/dev/null; then
ZTST_unimplemented="can't load the zsh/zutil module for testing"
fi
diff --git a/Test/V09datetime.ztst b/Test/V09datetime.ztst
index 1e677cd69..63ff4ee23 100644
--- a/Test/V09datetime.ztst
+++ b/Test/V09datetime.ztst
@@ -1,18 +1,18 @@
%prep
- if ! (zmodload zsh/datetime >/dev/null 2>/dev/null); then
+ if zmodload zsh/datetime 2>/dev/null; then
+ setopt multibyte
+ unset LC_ALL
+ LC_TIME=C
+ TZ=UTC+0
+ # It's not clear this skip_extensions is correct, but the
+ # format in question is causing problems on Solaris.
+ # We'll revist this after the release.
+ [[ "$(strftime %^_10B 0)" = " JANUARY" ]] || skip_extensions=1
+ [[ "$(LC_TIME=ja_JP.UTF-8 strftime %OS 1)" = 一 ]] || skip_japanese=1
+ else
ZTST_unimplemented="can't load the zsh/datetime module for testing"
fi
- setopt multibyte
- zmodload zsh/datetime
- unset LC_ALL
- LC_TIME=C
- TZ=UTC+0
- # It's not clear this skip_extensions is correct, but the
- # format in question is causing problems on Solaris.
- # We'll revist this after the release.
- [[ "$(strftime %^_10B 0)" = " JANUARY" ]] || skip_extensions=1
- [[ "$(LC_TIME=ja_JP.UTF-8 strftime %OS 1)" = 一 ]] || skip_japanese=1
%test
diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index 6c38e3974..f877455fd 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -2,16 +2,20 @@
%prep
- if ! (zmodload zsh/param/private >/dev/null 2>/dev/null); then
+ if ! zmodload zsh/param/private 2>/dev/null; then
ZTST_unimplemented="can't load the zsh/param/private module for testing"
fi
- zmodload zsh/param/private
%test
(zmodload -u zsh/param/private && zmodload zsh/param/private)
0:unload and reload the module without crashing
+ $ZTST_exe +Z -f $ZTST_srcdir/ztst.zsh $ZTST_srcdir/B02typeset.ztst
+0:typeset still works with zsh/param/private module loaded
+*>*
+*>*
+
typeset scalar_test=toplevel
() {
print $scalar_test
@@ -238,7 +242,7 @@ F:note "typeset" rather than "private" in output from outer
}
print Y ${(kv)hash_test} Z $array_test
}
- print ${(kv)hash_test}
+ print ${(kv)hash_test} ${(t)array_test}
0:privates are not visible in anonymous functions, part 3
>X top level
>Y in function Z in function
diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
index 14bc02ef8..ced70300f 100644
--- a/Test/X02zlevi.ztst
+++ b/Test/X02zlevi.ztst
@@ -3,7 +3,7 @@
%prep
if [[ $OSTYPE = cygwin ]]; then
ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+ elif ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
comptestinit -v -z $ZTST_testdir/../Src/zsh
else
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 383e6529f..1568369c8 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -3,7 +3,7 @@
%prep
if [[ $OSTYPE = cygwin ]]; then
ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+ elif ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
mkdir comp.tmp
cd comp.tmp
diff --git a/Test/Y02compmatch.ztst b/Test/Y02compmatch.ztst
index db734facc..e2f8e1a61 100644
--- a/Test/Y02compmatch.ztst
+++ b/Test/Y02compmatch.ztst
@@ -13,7 +13,7 @@
%prep
if [[ $OSTYPE = cygwin ]]; then
ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+ elif ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
mkdir match.tmp
cd match.tmp
diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst
index 0627104f5..0147c7d14 100644
--- a/Test/Y03arguments.ztst
+++ b/Test/Y03arguments.ztst
@@ -3,7 +3,7 @@
%prep
if [[ $OSTYPE = cygwin ]]; then
ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+ elif ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
mkdir comp.tmp
cd comp.tmp
diff --git a/Test/comptest b/Test/comptest
index 20a3a5b1d..f10739abe 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -5,7 +5,7 @@ comptestinit () {
$ZTST_srcdir/../Completion
$ZTST_srcdir/../Completion/*/*~*/CVS(/) )
- zmodload -i zsh/zpty || return $?
+ zmodload zsh/zpty || return $?
comptest_zsh=${ZSH:-zsh}
comptest_keymap=e
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index ce89a83ce..cdd84b55d 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -41,7 +41,7 @@ export MODULE_PATH
# We need to be able to save and restore the options used in the test.
# We use the $options variable of the parameter module for this.
-zmodload -i zsh/parameter
+zmodload zsh/parameter
# Note that both the following are regular arrays, since we only use them
# in whole array assignments to/from $options.