diff options
Diffstat (limited to 'tests/local.at')
-rw-r--r-- | tests/local.at | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/tests/local.at b/tests/local.at index 8193d93c..12443d44 100644 --- a/tests/local.at +++ b/tests/local.at @@ -29,6 +29,7 @@ m4_define([m4_null_if], [], [$2], [$3])]) + # AT_SETUP_STRIP(TITLE) # --------------------- # Abbreviate the TITLE to be passed to AT_SETUP. Remove new-lines @@ -50,15 +51,40 @@ m4_define([AT_SETUP_STRIP], ## Basic tests. ## ## ------------- ## + +# AT_PERL_CHECK(PERL-ARGS, ...) +# ----------------------------- +# If Perl is available, run this test. +m4_define([AT_PERL_CHECK], +[if test x"$PERL" != x; then + AT_CHECK(["$PERL" $1], [$2], [$3], [$4]) +fi +]) + + +# AT_REQUIRE(CMD, ...) +# -------------------- +# Same as AT_CHECK(...) but skip this test if we failed. +m4_define([AT_REQUIRE], +[AT_CHECK([$1 || exit 77], [$2], [$3], [$4])]) + + +# AT_PERL_REQUIRE(PERL-ARGS, ...) +# ------------------------------- +# Run this Perl program, or skip the test if Perl is not available. +m4_define([AT_PERL_REQUIRE], +[AT_REQUIRE(["$PERL" $1], [$2], [$3], [$4])]) + + # 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 || exit 77], [0], [$3 +[AT_PERL_CHECK([-0777 -ne ' + my $count = 0; + s{$2}{ ++$count; "" }gem; + printf "$count\n";' $1], [0], [$3 ])]) |