From bd11691d6520f7539e7ed2efdf75f266719e27e9 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 17 Feb 2000 03:03:19 +0000 Subject: Initial revision --- modules/shadow.test | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 modules/shadow.test (limited to 'modules/shadow.test') diff --git a/modules/shadow.test b/modules/shadow.test new file mode 100755 index 00000000..c8952b59 --- /dev/null +++ b/modules/shadow.test @@ -0,0 +1,91 @@ +#!/bin/sh + +# shadow.test is part of the GNU m4 testsuite + +. ${srcdir}/defs +. ../../tests/config.sh + +# cannot perform test without --with-modules +# test -z "$WITH_MODULES" && exit 77 + +cat ${srcdir}/shadow.m4 >in + +cat <<'EOF' >ok +# no modules loaded yet +test +shadow + +# define our own macros for `test' and `shadow' + + +local::test +local::shadow + +# save our local `shadow' macro until the Shadow module is unloaded + + +# module Shadow defines `shadow' and `test' macros +Shadow module loaded. + + +Shadow::test called. +Shadow::shadow called. + +# save the definition of `test' from the Shadow module + + +# module Test also defines a `test' macro +Test module loaded. + + +Test module called. +Shadow::shadow called. + +# Reloading Shadow shouldn't affect anything + + + +Test module called. +Shadow::shadow called. + +# Unloading Test will not unshadow the test definition in Shadow without +# some macro magic + + + + + +Shadow::test called. +Shadow::shadow called. + +# Unloading Shadow once has no effect (we loaded it twice) + + + +Shadow::test called. +Shadow::shadow called. + +# Unloading Shadow again will revert to copying `test' and the locally +# pushed `shadow' macro. + +test +local::shadow +EOF + +cat <<'EOF' >okerr +test: +shadow: +test: +shadow: +test: +shadow: +test: +shadow: +test: +shadow: +EOF + + +M4PATH=$srcdir:$srcdir/../tests $M4 -M `cd $srcdir; pwd` -d in >out 2>err +sed -e "s,^[^:]*[lt-]*m4[.ex]*:,m4:," err >sederr && mv sederr err +$CMP -s out ok && $CMP -s err okerr -- cgit v1.2.1