summaryrefslogtreecommitdiff
path: root/modules/shadow.test
diff options
context:
space:
mode:
authorJeff Bailey <jbailey@raspberryginger.com>2000-02-17 03:03:19 +0000
committerJeff Bailey <jbailey@raspberryginger.com>2000-02-17 03:03:19 +0000
commitbd11691d6520f7539e7ed2efdf75f266719e27e9 (patch)
tree13d3a4e534f6df846a128af52438769b9f51f09e /modules/shadow.test
downloadm4-bd11691d6520f7539e7ed2efdf75f266719e27e9.tar.gz
Initial revision
Diffstat (limited to 'modules/shadow.test')
-rwxr-xr-xmodules/shadow.test91
1 files changed, 91 insertions, 0 deletions
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: <test>
+shadow: <shadow>
+test: <test>
+shadow: <shadow>
+test: <test>
+shadow: <shadow>
+test: <test>
+shadow: <shadow>
+test: <test>
+shadow: <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