12 funclist='ALTEST_func1 ALTEST_funcexport ALTEST_funcu'
13 for funcname in $funclist; do
14 cat <<EOFFUNC > $funcname
17 echo this is $funcname
26 autoload ALTEST_func1 ALTEST_funcu
27 autoload -x ALTEST_funcexport
32 for funcname in $funclist; do
34 testname="$funcname loaded"
35 got=$(type $funcname 2>&1)
36 if [[ $got =~ "$funcname: not found" ]]; then
37 echo "## Failed $testname"
43 testname="$funcname is a shim"
44 if [[ ! $got =~ "IS_SHIM" ]]; then
45 echo "## Failed $testname"
51 testname="$funcname shim executed"
53 got=$(type $funcname 2>&1)
54 if [[ $got =~ "IS_SHIM" ]]; then
55 echo "## Failed $testname"
66 testname="$funcname shim reloaded"
68 got=$(type $funcname 2>&1)
69 if [[ ! $got =~ "IS_SHIM" ]]; then
70 echo "## Failed $testname"
78 testname="$funcname shim unloaded"
80 got=$(type $funcname 2>&1)
81 if [[ ! $got =~ "$funcname: not found" ]]; then
82 echo "## Failed $testname"
89 testname="autoload -p"
90 got=$(autoload -p | grep ALTEST)
91 if [[ ! $got =~ "autoload ALTEST_func1" ]] || \
92 [[ ! $got =~ "autoload ALTEST_funcexport" ]] ; then
93 echo "## Failed $testname"
100 testname="autoload -s"
101 echo "Executing $testname, could take a long time..."
102 got=$(autoload -s | grep ALTEST)
103 if [[ ! $got =~ "ALTEST_func1 not exported not executed" ]] || \
104 [[ ! $got =~ "ALTEST_funcexport exported executed" ]] ; then
105 echo "## Failed $testname"
109 echo "ok - $testname"
113 testname="autoload -r -a $FPATH"
114 autoload -r -a $FPATH
117 for funcname in $funclist; do
118 got=$(type $funcname 2>&1)
119 if [[ $got =~ "$funcname: not found" ]]; then
120 echo "## Failed $testname - $funcname"
124 if [[ ! $got =~ "IS_SHIM" ]]; then
131 if ((localfailed==0)); then
132 echo "ok - $testname"
138 testname="autoload -u $funclist"
139 autoload -u $funclist
142 for funcname in $funclist; do
143 got=$(type $funcname 2>&1)
144 if [[ ! $got =~ "$funcname: not found" ]]; then
145 echo "## Failed $testname - $funcname"
151 if ((localfailed==0)); then
152 echo "ok - $testname"
158 testname="autoload -r -f"
162 for funcname in $funclist; do
163 got=$(type $funcname 2>&1)
164 if [[ $got =~ "$funcname: not found" ]]; then
165 echo "## Failed $testname - $funcname"
169 if [[ ! $got =~ "IS_SHIM" ]]; then
176 if ((localfailed==0)); then
177 echo "ok - $testname"
183 echo $ok passed, $failed failed