m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

24-fyi-modules-at.patch


From: Akim Demaille
Subject: 24-fyi-modules-at.patch
Date: Wed, 29 Aug 2001 11:07:15 +0200

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * tests/others.at (Freezing modules)
        (--module-directory: absolute path, modpath2, modpath3)
        (M4MODPATH: absolute path, modtest, shadow, unload): Move to...
        * tests/modules.at: here, new file.
        * tests/others.at, tests/generate.awk: Add a banner.
        * tests/testsuite.at: Adjust.
        (AT_CHECK_M4_FILTER): New, but unused.

Index: tests/Makefile.am
--- tests/Makefile.am Tue, 28 Aug 2001 07:54:08 +0200 akim
+++ tests/Makefile.am Tue, 28 Aug 2001 18:09:15 +0200 akim
@@ -29,7 +29,7 @@
        iso8859.m4 incl.m4 foo \
        stackovf.test

-TESTSUITE_AT = testsuite.at others.at generated.at
+TESTSUITE_AT = testsuite.at others.at modules.at generated.at
 TESTSUITE = testsuite

 check-local: atconfig $(TESTSUITE)
Index: tests/generate.awk
--- tests/generate.awk Sun, 19 Aug 2001 23:00:40 +0200 akim
+++ tests/generate.awk Tue, 28 Aug 2001 18:09:05 +0200 akim
@@ -29,6 +29,8 @@
   print "#";
   print "# Copyright 1992, 2000, 2001 Free Software Foundation, Inc.";
   print ;
+  print "AT_BANNER([Documentation examples.])";
+  print ;
 }

 /address@hidden / {
Index: tests/others.at
--- tests/others.at Tue, 28 Aug 2001 17:46:49 +0200 akim
+++ tests/others.at Tue, 28 Aug 2001 18:08:21 +0200 akim
@@ -16,6 +16,8 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.

+AT_BANNER([Composite macros.])
+

 ## ---------- ##
 ## capitalize ##
@@ -740,152 +742,6 @@ m4: include.m4: 6: Cannot open NOFILE: N



-## --------- ##
-## modfreeze ##
-## --------- ##
-# Written by Gary V. Vaughan <address@hidden>
-
-AT_SETUP([modfreeze])
-
-AT_DATA([[frozen.m4]],
-[[divert(1)dnl
-define(`test', `local::`test'')dnl
-define(`test1', defn(`test'))dnl
-->test
-load(`modtest')
-define(`test2', defn(`test'))dnl
-->test
-load(`shadow')
-define(`test3', defn(`test'))dnl
-->test
-]])
-
-AT_DATA([[unfrozen.m4]],
-[[undivert(1)dnl
-test1
-test2
-test3
-]])
-
-# First generate the `expout' ouput by running over the sources before
-# freezeing.
-AT_CHECK_M4([-m load frozen.m4 unfrozen.m4], 0,
-            [stdout], [stderr])
-
-mv stdout expout
-mv stderr experr
-
-# Now freeze the first source file.
-AT_CHECK_M4([-m load -F frozen.m4f frozen.m4], 0,
-            [ignore], [ignore])
-
-# Now rerun the original sequence, but using the frozen file.
-AT_CHECK_M4([-R frozen.m4f unfrozen.m4], 0,
-            [expout], [experr])
-
-AT_CLEANUP([frozen.m4f])
-
-
-
-## -------- ##
-## modpath1 ##
-## -------- ##
-# Written by Gary V. Vaughan <address@hidden>
-
-AT_SETUP([--module-directory: absolute path])
-
-AT_CHECK([M4PATH=$top_srcdir m4 -M `cd $top_builddir/modules; pwd` -m load -d 
modules/modtest.m4], 0,
-[[Test module loaded.
-Test module called.
-Dumpdef: .
-]],
-[[test:        <test>
-]])
-
-AT_CLEANUP
-
-
-
-## -------- ##
-## modpath2 ##
-## -------- ##
-# Written by Gary V. Vaughan <address@hidden>
-
-AT_SETUP([modpath2])
-
-AT_CHECK([M4PATH=$top_srcdir LTDL_LIBRARY_PATH=$top_builddir/modules m4 -m 
load -d modules/modtest.m4], 0,
-[[Test module loaded.
-Test module called.
-Dumpdef: .
-]],
-[[test:        <test>
-]])
-
-AT_CLEANUP
-
-
-
-## -------- ##
-## modpath3 ##
-## -------- ##
-# Written by Gary V. Vaughan <address@hidden>
-
-AT_SETUP([modpath3])
-
-AT_DATA([[in]],
-[[test
-Dumpdef: dumpdef(`test').
-]])
-
-AT_CHECK([m4 -m load -m modtest -M $top_builddir/modules -d in], 0,
-[[Test module called.
-Dumpdef: .
-]],
-[[test:        <test>
-]])
-
-AT_CLEANUP
-
-
-
-## -------- ##
-## modpath4 ##
-## -------- ##
-# Written by Gary V. Vaughan <address@hidden>
-
-AT_SETUP([M4MODPATH: absolute path])
-
-AT_CHECK([M4PATH=$top_srcdir M4MODPATH=`cd $top_builddir/modules; pwd` m4 -m 
load -d modules/modtest.m4], 0,
-[[Test module loaded.
-Test module called.
-Dumpdef: .
-]],
-[[test:        <test>
-]])
-
-AT_CLEANUP
-
-
-
-## ------- ##
-## modtest ##
-## ------- ##
-# Written by Gary V. Vaughan <address@hidden>
-
-AT_SETUP([modtest])
-
-AT_CHECK([M4PATH=$top_srcdir m4 -M $top_builddir/modules -m load -d 
modules/modtest.m4], 0,
-[[Test module loaded.
-Test module called.
-Dumpdef: .
-]],
-[[test:        <test>
-]])
-
-AT_CLEANUP
-
-
-
 ## ----------- ##
 ## multiquotes ##
 ## ----------- ##
@@ -1123,145 +979,6 @@ m4trace: -1- regexp(`hej med dig', `m\(.



-## ------ ##
-## shadow ##
-## ------ ##
-# Written by Gary V. Vaughan <address@hidden>
-
-AT_SETUP([shadow])
-
-AT_DATA([[shadow.m4]],
-[[# no modules loaded yet
-test
-shadow
-
-# define our own macros for `test' and `shadow'
-define(`test', `local::`test'')
-define(`shadow', `local::`shadow'')
-test
-shadow
-
-# module Shadow defines `shadow' and `test' macros
-load(`shadow')
-dumpdef(`test')
-dumpdef(`shadow')
-test
-shadow
-
-# save the definition of `test' from the Shadow module
-define(`Shadow::test', defn(`test'))
-
-# module Test also defines a `test' macro
-load(`modtest')
-dumpdef(`test')
-dumpdef(`shadow')
-test
-shadow
-
-# Reloading Shadow shouldn't affect anything
-load(`shadow')
-dumpdef(`test')
-dumpdef(`shadow')
-test
-shadow
-
-# Unloading Test will unshadow the test definition in Shadow
-unload(`modtest')
-dumpdef(`test')
-dumpdef(`shadow')
-test
-shadow
-
-# Unloading Shadow once has no effect (we loaded it twice)
-unload(`shadow')
-dumpdef(`test')
-dumpdef(`shadow')
-test
-shadow
-
-# Unloading Shadow again will revert to copying `test' and the local
-# `shadow' macro.
-unload(`shadow')
-test
-shadow
-]])
-
-AT_DATA([[expout]],
-[[# no modules loaded yet
-test
-shadow
-
-# define our own macros for `test' and `shadow'
-
-
-local::test
-local::shadow
-
-# 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 unshadow the test definition in Shadow
-
-
-
-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 local
-# `shadow' macro.
-
-local::test
-local::shadow
-]])
-
-AT_DATA([[experr]],
-[[test:        <test>
-shadow:        <shadow>
-test:  <test>
-shadow:        <shadow>
-test:  <test>
-shadow:        <shadow>
-test:  <test>
-shadow:        <shadow>
-test:  <test>
-shadow:        <shadow>
-]])
-
-AT_CHECK_M4([-m load shadow.m4], 0,
-            [expout], [experr])
-
-AT_CLEANUP
-
-
-
 ## ------------ ##
 ## sync-lines.  ##
 ## ------------ ##
@@ -1568,65 +1285,6 @@ m4trace: -1- move(auxilliary, destinatio
 This is to be UNDIVERTED soon.

 ]])
-
-AT_CLEANUP
-
-
-
-## ------ ##
-## unload ##
-## ------ ##
-# Written by Gary V. Vaughan <address@hidden>
-
-AT_SETUP([unload])
-
-AT_DATA([[in]],
-[[test
-__test__
-load(`modtest')
-test
-__test__
-load(`shadow')
-test
-__test__
-unload(`modtest')
-test
-__test__
-load(`modtest')
-test
-__test__
-unload(`modtest')
-test
-__test__
-unload(`shadow')
-test
-__test__
-]])
-
-AT_DATA([[expout]],
-[[test
-__test__
-Test module loaded.
-Test module called.
-modtest
-Shadow module loaded.
-Shadow::test called.
-shadow
-
-Shadow::test called.
-shadow
-Test module loaded.
-Test module called.
-modtest
-
-Shadow::test called.
-shadow
-
-test
-__test__
-]])
-
-AT_CHECK_M4([-m load in], 0, expout)

 AT_CLEANUP

Index: tests/testsuite.at
--- tests/testsuite.at Tue, 28 Aug 2001 17:46:49 +0200 akim
+++ tests/testsuite.at Tue, 28 Aug 2001 18:06:27 +0200 akim
@@ -21,13 +21,24 @@
 # We need a recent Autotest.
 m4_version_prereq([2.52c])

-# AT_CHECK_M4(FLAGS, [EXIT-STATUS], [STDOUT], [STDERR])
-# -----------------------------------------------------
+# AT_CHECK_M4(ARGS, [EXIT-STATUS], [STDOUT], [STDERR])
+# ----------------------------------------------------
 # Hide the impact of libtool on program_invocation_name, and hide
 # the differences of paths when src != build.
 m4_define([AT_CHECK_M4],
-[AT_CHECK([m4 -b -d $1],
-          [$2], [$3], [$4])
+[AT_CHECK([m4 -b -d $1], [$2], [$3], [$4])
+])
+
+
+# AT_CHECK_M4_FILTER(TITLE, INPUT, [STDOUT], [STDERR])
+# ----------------------------------------------------
+# Hide the impact of libtool on program_invocation_name, and hide
+# the differences of paths when src != build.
+m4_define([AT_CHECK_M4_FILTER],
+[AT_SETUP([$1])
+AT_DATA([[in.m4]], [$2])
+AT_CHECK_M4([[in.m4]], 0, [$4], [$5])
+AT_CLEANUP
 ])


@@ -44,6 +55,9 @@ m4_define([AT_CHECK_M4],

 # Hand crafted tests.
 m4_include([others.at])
+
+# Torturing the modules support.
+m4_include([modules.at])

 # From the documention.
 m4_include([generated.at])
Index: tests/modules.at
--- tests/modules.at Tue, 28 Aug 2001 18:21:02 +0200 akim
+++ tests/modules.at Tue, 28 Aug 2001 18:18:49 +0200 akim
@@ -0,0 +1,368 @@
+# Hand crafted tests for GNU M4.                               -*- Autotest -*-
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+AT_BANNER([Module support.])
+
+
+## --------- ##
+## modfreeze ##
+## --------- ##
+# Written by Gary V. Vaughan <address@hidden>
+
+AT_SETUP([Freezing modules])
+
+AT_DATA([[frozen.m4]],
+[[divert(1)dnl
+define(`test', `local::`test'')dnl
+define(`test1', defn(`test'))dnl
+->test
+load(`modtest')
+define(`test2', defn(`test'))dnl
+->test
+load(`shadow')
+define(`test3', defn(`test'))dnl
+->test
+]])
+
+AT_DATA([[unfrozen.m4]],
+[[undivert(1)dnl
+test1
+test2
+test3
+]])
+
+# First generate the `expout' ouput by running over the sources before
+# freezeing.
+AT_CHECK_M4([-m load frozen.m4 unfrozen.m4], 0,
+            [stdout], [stderr])
+
+mv stdout expout
+mv stderr experr
+
+# Now freeze the first source file.
+AT_CHECK_M4([-m load -F frozen.m4f frozen.m4], 0,
+            [ignore], [ignore])
+
+# Now rerun the original sequence, but using the frozen file.
+AT_CHECK_M4([-R frozen.m4f unfrozen.m4], 0,
+            [expout], [experr])
+
+AT_CLEANUP([frozen.m4f])
+
+
+
+## ----------------------------------- ##
+## --module-directory: absolute path.  ##
+## ----------------------------------- ##
+
+# Written by Gary V. Vaughan <address@hidden>
+
+AT_SETUP([--module-directory: absolute path])
+
+AT_CHECK(M4PATH=$top_srcdir [m4 -M `cd $top_builddir/modules; pwd` -m load -d 
modules/modtest.m4], 0,
+[[Test module loaded.
+Test module called.
+Dumpdef: .
+]],
+[[test:        <test>
+]])
+
+AT_CLEANUP
+
+
+
+## -------- ##
+## modpath2 ##
+## -------- ##
+
+# Written by Gary V. Vaughan <address@hidden>
+
+AT_SETUP([modpath2])
+
+AT_CHECK([M4PATH=$top_srcdir LTDL_LIBRARY_PATH=$top_builddir/modules m4 -m 
load -d modules/modtest.m4], 0,
+[[Test module loaded.
+Test module called.
+Dumpdef: .
+]],
+[[test:        <test>
+]])
+
+AT_CLEANUP
+
+
+
+## -------- ##
+## modpath3 ##
+## -------- ##
+
+# Written by Gary V. Vaughan <address@hidden>
+
+AT_SETUP([modpath3])
+
+AT_DATA([[in]],
+[[test
+Dumpdef: dumpdef(`test').
+]])
+
+AT_CHECK([M4PATH=$top_srcdir m4 -m load -m modtest -M $top_builddir/modules -d 
in], 0,
+[[Test module called.
+Dumpdef: .
+]],
+[[test:        <test>
+]])
+
+AT_CLEANUP
+
+
+
+## -------- ##
+## modpath4 ##
+## -------- ##
+# Written by Gary V. Vaughan <address@hidden>
+
+AT_SETUP([M4MODPATH: absolute path])
+
+AT_CHECK([M4MODPATH=`cd $top_builddir/modules; pwd` M4PATH=$top_srcdir m4 -m 
load -d modules/modtest.m4], 0,
+[[Test module loaded.
+Test module called.
+Dumpdef: .
+]],
+[[test:        <test>
+]])
+
+AT_CLEANUP
+
+
+
+## ------- ##
+## modtest ##
+## ------- ##
+# Written by Gary V. Vaughan <address@hidden>
+
+AT_SETUP([modtest])
+
+AT_CHECK([M4PATH=$top_srcdir m4 -M $top_builddir/modules -m load -d 
modules/modtest.m4], 0,
+[[Test module loaded.
+Test module called.
+Dumpdef: .
+]],
+[[test:        <test>
+]])
+
+AT_CLEANUP
+
+
+
+## ------ ##
+## shadow ##
+## ------ ##
+
+# Written by Gary V. Vaughan <address@hidden>
+
+AT_SETUP([shadow])
+
+AT_DATA([[shadow.m4]],
+[[# no modules loaded yet
+test
+shadow
+
+# define our own macros for `test' and `shadow'
+define(`test', `local::`test'')
+define(`shadow', `local::`shadow'')
+test
+shadow
+
+# module Shadow defines `shadow' and `test' macros
+load(`shadow')
+dumpdef(`test')
+dumpdef(`shadow')
+test
+shadow
+
+# save the definition of `test' from the Shadow module
+define(`Shadow::test', defn(`test'))
+
+# module Test also defines a `test' macro
+load(`modtest')
+dumpdef(`test')
+dumpdef(`shadow')
+test
+shadow
+
+# Reloading Shadow shouldn't affect anything
+load(`shadow')
+dumpdef(`test')
+dumpdef(`shadow')
+test
+shadow
+
+# Unloading Test will unshadow the test definition in Shadow
+unload(`modtest')
+dumpdef(`test')
+dumpdef(`shadow')
+test
+shadow
+
+# Unloading Shadow once has no effect (we loaded it twice)
+unload(`shadow')
+dumpdef(`test')
+dumpdef(`shadow')
+test
+shadow
+
+# Unloading Shadow again will revert to copying `test' and the local
+# `shadow' macro.
+unload(`shadow')
+test
+shadow
+]])
+
+AT_DATA([[expout]],
+[[# no modules loaded yet
+test
+shadow
+
+# define our own macros for `test' and `shadow'
+
+
+local::test
+local::shadow
+
+# 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 unshadow the test definition in Shadow
+
+
+
+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 local
+# `shadow' macro.
+
+local::test
+local::shadow
+]])
+
+AT_DATA([[experr]],
+[[test:        <test>
+shadow:        <shadow>
+test:  <test>
+shadow:        <shadow>
+test:  <test>
+shadow:        <shadow>
+test:  <test>
+shadow:        <shadow>
+test:  <test>
+shadow:        <shadow>
+]])
+
+AT_CHECK_M4([-m load shadow.m4], 0,
+            [expout], [experr])
+
+AT_CLEANUP
+
+
+
+## ------ ##
+## unload ##
+## ------ ##
+
+# Written by Gary V. Vaughan <address@hidden>
+
+AT_SETUP([unload])
+
+AT_DATA([[in]],
+[[test
+__test__
+load(`modtest')
+test
+__test__
+load(`shadow')
+test
+__test__
+unload(`modtest')
+test
+__test__
+load(`modtest')
+test
+__test__
+unload(`modtest')
+test
+__test__
+unload(`shadow')
+test
+__test__
+]])
+
+AT_DATA([[expout]],
+[[test
+__test__
+Test module loaded.
+Test module called.
+modtest
+Shadow module loaded.
+Shadow::test called.
+shadow
+
+Shadow::test called.
+shadow
+Test module loaded.
+Test module called.
+modtest
+
+Shadow::test called.
+shadow
+
+test
+__test__
+]])
+
+AT_CHECK_M4([-m load in], 0, expout)
+
+AT_CLEANUP



reply via email to

[Prev in Thread] Current Thread [Next in Thread]