Fix portability issue in the test suite.

* tests/local.at (AT_MATCHES_CHECK): New.
	Based on Perl instead of Sed.  Sed has too many portability
	pitfalls, not ever Sed is GNU Sed.
	* tests/actions.at (Fix user actions without a trailing semicolon):
	Use it.
(cherry picked from commit 6617622c9a)
This commit is contained in:
Akim Demaille
2008-12-08 10:26:38 +01:00
committed by Joel E. Denny
parent 42f4393a72
commit c4fae1ef48
3 changed files with 31 additions and 15 deletions

View File

@@ -1400,20 +1400,11 @@ input.y:35.1: warning: future versions of Bison will not add the `;'
input.y:36.1: warning: a `;' might be needed at the end of action code
input.y:36.1: warning: future versions of Bison will not add the `;'
]])
AT_CHECK([[grep -c '/\* TEST:N:2 \*/ }$' input.c]], [0], [[3
]])
AT_CHECK([[grep -c '/\* TEST:Y:2 \*/ ;}$' input.c]], [0], [[6
]])
AT_CHECK([[sed -n '/TEST:N:1/{N
s/\n/<NL>/gp}' input.c | grep -c '// TEST:N:1 [;{}]*<NL>}$']], [0], [[6
]])
AT_CHECK([[sed -n '/TEST:Y:1/{N
s/\n/<NL>/gp}' input.c | grep -c '// TEST:Y:1 [;{}]*<NL>;}$']], [0], [[12
]])
AT_CHECK([[sed -n '/^#define TEST_MACRO_N/{N
N
s/\n/<NL>/gp}' input.c | grep -F -xc '#define TEST_MACRO_N \<NL>[]"broken\" $ @ $$ @$ [];\<NL>string;"}']],
[0], [[2
]])
AT_MATCHES_CHECK([input.c], [[/\* TEST:N:2 \*/ \}$]], [[3]])
AT_MATCHES_CHECK([input.c], [[/\* TEST:Y:2 \*/ ;\}$]], [[6]])
AT_MATCHES_CHECK([input.c], [[// TEST:N:1 [;{}]*\n\}$]], [[6]])
AT_MATCHES_CHECK([input.c], [[// TEST:Y:1 [;{}]*\n;\}$]], [[12]])
AT_MATCHES_CHECK([input.c], [[#define TEST_MACRO_N \\\n\[\]"broken\\" \$ \@ \$\$ \@\$ \[\];\\\nstring;"\}]], [[2]])
AT_CLEANUP