From b1688305cc83e63104d4c581f649bbdcffa0e3b8 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 21 Nov 2015 23:56:25 -0800 Subject: 37181: consistent use of zmodload and corresponding ZTST_unimplemented or ZTST_skip --- Test/C02cond.ztst | 18 +++++++++++------- Test/D07multibyte.ztst | 2 +- Test/V01zmodload.ztst | 6 +++--- Test/V02zregexparse.ztst | 4 +++- Test/V03mathfunc.ztst | 5 +---- Test/V04features.ztst | 3 ++- Test/V05styles.ztst | 4 +--- Test/V09datetime.ztst | 22 +++++++++++----------- Test/V10private.ztst | 3 +-- Test/X02zlevi.ztst | 2 +- Test/Y01completion.ztst | 2 +- Test/Y02compmatch.ztst | 2 +- Test/Y03arguments.ztst | 2 +- Test/comptest | 2 +- Test/ztst.zsh | 2 +- 15 files changed, 40 insertions(+), 39 deletions(-) (limited to 'Test') 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..c66f17587 100644 --- a/Test/V10private.ztst +++ b/Test/V10private.ztst @@ -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 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. -- cgit 1.4.1