[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
27-fyi-testsuite-selfcontained.patch
From: |
Akim Demaille |
Subject: |
27-fyi-testsuite-selfcontained.patch |
Date: |
Wed, 05 Sep 2001 09:15:40 +0200 |
Index: ChangeLog
from Akim Demaille <address@hidden>
Improve the test suite's selfcontainedness.
* doc/m4.texinfo: Let `input.m4' be the input file, not `in'.
(Include, Undivert): Tag the other input files.
* tests/generate.awk: Catch address@hidden file:'.
`-I $src' is no longer needed.
`next' is really like `return': the rest is skipped.
Adjust to `input.m4'.
(fatal): New function.
* tests/foo, tests/incl.m4: Remove.
Index: doc/m4.texinfo
--- doc/m4.texinfo Mon, 03 Sep 2001 15:40:52 +0200 akim
+++ doc/m4.texinfo Mon, 03 Sep 2001 16:17:17 +0200 akim
@@ -2117,7 +2117,7 @@ @node Changesyntax
define(`test.1', `TEST ONE')
@result{}
__file__
address@hidden
address@hidden
changesyntax(`O_', `W.')
@result{}
__file__
@@ -2361,13 +2361,13 @@ @node Include
@example
include(`no-such-file')
@result{}
address@hidden: in: 1: Cannot open no-such-file: No such file or directory
address@hidden: input.m4: 1: Cannot open no-such-file: No such file or directory
sinclude(`no-such-file')
@result{}
@end example
Assume in the following that the file @file{incl.m4} contains the lines:
address@hidden ignore
address@hidden file: incl.m4
@example
Include file start
foo
@@ -2570,7 +2570,15 @@ @node Undivert
argument, the contents of the file named will be copied, uninterpreted, to
the current output. This complements the builtin @code{include}
(@pxref{Include}). To illustrate the difference, assume the file
address@hidden contains the word @samp{bar}:
address@hidden contains:
+
address@hidden file: foo
address@hidden
+bar
address@hidden example
+
address@hidden
+then
@example
define(`bar', `BAR')
@@ -3178,7 +3186,7 @@ @node Eval
define(`foo', `666')
@result{}
eval(`foo / 6')
address@hidden: in: 7: Bad expression in eval: foo / 6
address@hidden: input.m4: 7: Bad expression in eval: foo / 6
@result{}
eval(foo/6)
@result{}111
@@ -3404,7 +3412,7 @@ @node Errprint
@example
errprint(`m4:'__file__:__line__: `Input error
')
address@hidden:in:1: Input error
address@hidden:input.m4:1: Input error
@result{}
@end example
@end deffn
@@ -3427,7 +3435,7 @@ @node M4exit
')m4exit(1)')
@result{}
fatal_error(`This is a BAD one, buster')
address@hidden: in: 3: fatal error: This is a BAD one, buster
address@hidden: input.m4: 3: fatal error: This is a BAD one, buster
@end example
After this macro call, @code{m4} will exit with exit code 1. This macro
Index: tests/Makefile.am
--- tests/Makefile.am Thu, 30 Aug 2001 15:53:29 +0200 akim
+++ tests/Makefile.am Mon, 03 Sep 2001 16:18:05 +0200 akim
@@ -26,8 +26,7 @@
MAINTAINERCLEANFILES = Makefile.in generated.at $(TESTSUITE)
OTHER_FILES = \
- iso8859.m4 incl.m4 foo \
- stackovf.test
+ iso8859.m4 stackovf.test
TESTSUITE_AT = \
testsuite.at \
Index: tests/generate.awk
--- tests/generate.awk Mon, 03 Sep 2001 15:40:52 +0200 akim
+++ tests/generate.awk Mon, 03 Sep 2001 16:14:56 +0200 akim
@@ -42,6 +42,10 @@
seq = 0;
}
+/address@hidden file: / {
+ file = $3;
+}
+
/address@hidden ignore$/ {
getline;
next;
@@ -59,20 +63,40 @@
{
if (seq == 0)
new_group(node);
- seq++;
- printf ("# From example in %s line %d.\n\n", FILENAME, NR)
+ if (!file)
+ seq++;
+ printf ("# %s:%d\n", FILENAME, NR)
next;
}
- else if ($0 ~ /address@hidden example$/)
+
+ if ($0 ~ /address@hidden example$/)
{
- new_test(input, status, output, error);
- status = 0;
- input = output = error = "";
+ if (file != "")
+ {
+ if (output || error)
+ {
+ fatal("while getting file " file \
+ " found output = " output "," \
+ " found error = " error);
+
+ }
+ input = normalize(input);
+ printf ("# FOO: %s\n", file);
+ printf ("AT_DATA([[%s]],\n[[%s]])\n\n", file, input);
+ }
+ else
+ {
+ new_test(input, status, output, error);
+ status = 0;
+ }
+ file = input = output = error = "";
next;
}
- else if ($0 ~ /^\^D$/)
+
+ if ($0 ~ /^\^D$/)
next;
- else if ($0 ~ /address@hidden/)
+
+ if ($0 ~ /address@hidden/)
output = output $0 "\n";
else if ($0 ~ /address@hidden/)
error = error $0 "\n";
@@ -126,9 +150,9 @@
output = normalize(output);
error = normalize(error);
- printf ("AT_DATA([[in]],\n[[%s]])\n\n", input);
+ printf ("AT_DATA([[input.m4]],\n[[%s]])\n\n", input);
# Some of these tests `include' files from tests/.
- printf ("AT_CHECK_M4([[-I $srcdir in]], %s,", status);
+ printf ("AT_CHECK_M4([[input.m4]], %s,", status);
if (output)
printf ("\n[[%s]]", output);
else
@@ -138,4 +162,9 @@
else
printf (")");
printf ("\n\n");
+}
+
+function fatal(msg) {
+ print "generate.awk: " msg > "/dev/stderr"
+ exit 1
}
Index: tests/foo
--- tests/foo Fri, 10 Aug 2001 14:01:13 +0200 akim
+++ tests/foo Mon, 03 Sep 2001 16:24:00 +0200 akim
@@ -1 +0,0 @@
-bar
Index: tests/incl.m4
--- tests/incl.m4 Thu, 19 Nov 1998 14:02:11 +0100 demaille
+++ tests/incl.m4 Mon, 03 Sep 2001 16:24:00 +0200 akim
@@ -1,3 +0,0 @@
-Include file start
-foo
-Include file end