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.
This commit is contained in:
Akim Demaille
2008-12-08 10:26:38 +01:00
parent 2ca1136c7c
commit 6617622c9a
3 changed files with 31 additions and 15 deletions

View File

@@ -20,6 +20,22 @@
m4_version_prereq([2.58])
## ------------- ##
## Basic tests. ##
## ------------- ##
# AT_MATCHES_CHECK(FILE, PERL-REGEXP, COUNT)
# ------------------------------------------
# Expect COUNT matches of the PERL-REGEXP in FILE. The file is
# taken in "slurp" mode, i.e., one can match end-of-lines.
m4_define([AT_MATCHES_CHECK],
[AT_CHECK([perl -0777 -ne '
my $count = 0;
s{$2}{ ++$count; "" }gem;
printf "$count\n";' $1], [0], [$3
])])
## ------------------------------- ##
## Macros decoding Bison options. ##
## ------------------------------- ##