37181: consistent use of zmodload and corresponding ZTST_unimplemented or ZTST_skip

This commit is contained in:
Barton E. Schaefer
2015-11-21 23:56:25 -08:00
parent cce4261a3c
commit b1688305cc
16 changed files with 50 additions and 39 deletions

View File

@@ -1,3 +1,13 @@
2015-11-21 Barton E. Schaefer <schaefer@zsh.org>
* 37181: Test/C02cond.ztst, Test/D07multibyte.ztst,
Test/V01zmodload.ztst, Test/V02zregexparse.ztst,
Test/V03mathfunc.ztst, Test/V04features.ztst, Test/V05styles.ztst,
Test/V09datetime.ztst, Test/V10private.ztst, Test/X02zlevi.ztst,
Test/Y01completion.ztst, Test/Y02compmatch.ztst,
Test/Y03arguments.ztst, Test/comptest, Test/ztst.zsh: consistent
use of zmodload and corresponding ZTST_unimplemented or ZTST_skip
2015-11-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
* unposted: Config/version.mk, Etc/FAQ.yo, README: make

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -2,10 +2,9 @@
%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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.