From e272d9dc80291b22a3a80675e2cefafdd40a8581 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 5 Oct 2012 09:20:30 +0200 Subject: [PATCH] tests: fix sed portability issues Reported by Didier Godefroy, . * tests/calc.at (AT_CHECK_SPACES): Use Perl. --- tests/calc.at | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/calc.at b/tests/calc.at index 3aab8681..a1c11e5f 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -503,12 +503,15 @@ AT_CHECK([cat stderr], 0, [expout]) # Make sure we did not introduce bad spaces. Checked here because all # the skeletons are (or should be) exercized here. m4_define([AT_CHECK_SPACES], -[# No initial empty lines. -AT_CHECK([sed -ne '/./q;=;p;' $1]) -# No trailing spaces. -# FIXME: For 2.7: AT_CHECK([sed -ne '/[ ]$/{=;p;}' $1]) -# No final empty lines. -AT_CHECK([sed -ne '${/^$/{=;p;};}' $1]) +[AT_CHECK([perl -ne ' + chomp; + print "$.: {$_}\n" + if (# No starting/ending empty lines. + (eof || $. == 1) && /^\s*$/ + # No trailing space. FIXME: not ready for "maint". + # || /\s$/ + )' $1 +])dnl ]) -- 2.45.2