From f73dc99e08bc47a8885145065a09922845d1ba4a Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Wed, 23 May 2001 17:05:56 +0000 Subject: Revise zmodload -u test. --- Test/V01zmodload.ztst | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'Test/V01zmodload.ztst') diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst index 0828102a6..f5185eb21 100644 --- a/Test/V01zmodload.ztst +++ b/Test/V01zmodload.ztst @@ -5,6 +5,7 @@ # the config.modules file. This differs for static vs. dynamic builds. mods=() + deps="$(zmodload -Ld)" while read name modfile link auto load funcs do [[ $name == \#* ]] && continue @@ -13,6 +14,27 @@ mods=($mods $name) done < $ZTST_testdir/../config.modules + zmodunload() { + local m n=$# + (( n == 0 )) && return 0 + for m + do + if [[ -z ${(M)${(f)"$(zmodload -d)"}:#*:* $m( *|)} ]] + then + zmodload -u $m && zmodload -ud $m || return 1 + shift + else + set $@[2,-1] $m + fi + done + if (( $# < n )) + then + zmodunload $* + else + zmodload -u $* + fi + } + %test # This first test depends on knowing that zsh is run with +Z from the @@ -125,22 +147,15 @@ zmodload -e example 1:Delete the module alias again -# Remove all inter-module dependencies so that we can unload in any order. -# Skip the two modules that are required by the test system! +# Don't unload the two modules that are required by the test system! mods[(r)zsh/main]=() mods[(r)zsh/parameter]=() - for m in $mods - do - zmodload -ud $m - done -0d:Remove module dependecies - -# Unload all the modules again (except the two we skipped, of course). - - zmodload -u $mods + zmodunload $mods 0d:Unload the modules loaded by this test suite %clean - unset name modfile link auto load funcs mods m + eval "$deps" + unset deps name modfile link auto load funcs mods + unfunction zmodunload -- cgit 1.4.1