summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2008-12-02 22:51:14 -0700
committerEric Blake <ebb9@byu.net>2008-12-02 22:51:14 -0700
commit41d0c77062c8046730101d82b56f682edc70957e (patch)
treec4f887b503240ede7246dd10c2dfba838189ed8b /tests
parentc6628fa51d6c7756f38d1dfaa2055656446ee93a (diff)
downloadm4-41d0c77062c8046730101d82b56f682edc70957e.tar.gz
Stage 27: Allow embedded NUL in text processing macros.
* modules/m4.c (m4_expand_ranges): Don't append extra bytes. (translit): Manage NUL bytes. * modules/format.c (format): Likewise. * modules/gnu.c (substitute, regexp_substitute): Likewise. (m4_resyntax_encode_safe): Add parameter. (regexp, patsubst, renamesyms): Update callers. (regexp_compile): Adjust error message. * modules/evalparse.c (m4_evaluate): Use consistent message. (end_text): New variable. (eval_init_lex): Add parameter. (eval_lex): Detect embedded NUL. * src/freeze.c (reload_frozen_state): Likewise. * doc/m4.texinfo (Format): Update to cover new behavior. (Eval): Mention that result is unquoted. * tests/freeze.at (reloading nul): Enhance test. * tests/null.m4: Likewise. * tests/null.err: Update expected output. * tests/null.out: Likewise. * tests/options.at (--regexp-syntax): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/freeze.at6
-rw-r--r--tests/null.errbin639 -> 1318 bytes
-rw-r--r--tests/null.m4bin7223 -> 7559 bytes
-rw-r--r--tests/null.outbin548 -> 607 bytes
-rw-r--r--tests/options.at8
5 files changed, 10 insertions, 4 deletions
diff --git a/tests/freeze.at b/tests/freeze.at
index 9b8c9463..693ae543 100644
--- a/tests/freeze.at
+++ b/tests/freeze.at
@@ -409,6 +409,12 @@ AT_CHECK_M4([-R frozen.m4f unfrozen.m4], [0], [stdout], [experr], [], [ ])
AT_CHECK([cat out1 stdout], [0], [expout])
+dnl Check that unexpected embedded NULs are recognized.
+printf '# bogus frozen file\nV2\nR4\ngnu\0\n' > bogus.m4f
+AT_CHECK_M4([-R bogus.m4f], [1], [],
+[[m4:bogus.m4f:4: bad syntax-spec `gnu\0'
+]])
+
AT_CLEANUP
])
diff --git a/tests/null.err b/tests/null.err
index 74ec09d3..7b9f7981 100644
--- a/tests/null.err
+++ b/tests/null.err
Binary files differ
diff --git a/tests/null.m4 b/tests/null.m4
index 77b6e67d..f7a15875 100644
--- a/tests/null.m4
+++ b/tests/null.m4
Binary files differ
diff --git a/tests/null.out b/tests/null.out
index 5f6df390..97f80dd5 100644
--- a/tests/null.out
+++ b/tests/null.out
Binary files differ
diff --git a/tests/options.at b/tests/options.at
index 9331a211..dce43f87 100644
--- a/tests/options.at
+++ b/tests/options.at
@@ -714,8 +714,8 @@ AT_CHECK_M4([--regexp-syntax=unknown in], [1], [],
AT_CHECK_M4([--regexp-syntax= in], [0], [[0
]])
-AT_CHECK_M4([-rEXTENDED in], [1], [[
-]], [[m4:in:1: regexp: bad regular expression `(': Unmatched ( or \(
+AT_CHECK_M4([-rEXTENDED in], [0], [[
+]], [[m4:in:1: Warning: regexp: bad regular expression `(': Unmatched ( or \(
]])
AT_CHECK_M4([-rgnu-m4 in], [0], [[0
@@ -725,9 +725,9 @@ AT_CHECK_M4([-r"gnu M4" in], [0], [[0
]])
dnl Test behavior of -r intermixed with files
-AT_CHECK_M4([-rEXTENDED in --regexp-syntax in], [1], [[
+AT_CHECK_M4([-rEXTENDED in --regexp-syntax in], [0], [[
0
-]], [[m4:in:1: regexp: bad regular expression `(': Unmatched ( or \(
+]], [[m4:in:1: Warning: regexp: bad regular expression `(': Unmatched ( or \(
]])
AT_CLEANUP