summaryrefslogtreecommitdiff
path: root/lib/tap-driver.sh
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-12-27 11:45:59 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-12-27 18:30:00 +0100
commit2fa8a9e975ce30702c87bd827b61f6e59ad98678 (patch)
tree8c1d3d64374a2e1bbd7acd263fa0faa97eb7b3bf /lib/tap-driver.sh
parent58f034a3eebeaa1b16415fbb76e02fe378d6413f (diff)
downloadautomake-2fa8a9e975ce30702c87bd827b61f6e59ad98678.tar.gz
tap/awk: "Bail out!" recognized also after leading whitespace
Newer versions of TAP::Harness (e.g., 3.23 on Perl 5.14.1) recognize a "Bail out!" directive also when it is prepended by leading whitespace; this was not the case for older TAP:Harness versions, (e.g., for version 3.17 on Perl 5.12.4), and for our TAP driver implemented in awk. * lib/tap-driver.sh: Handle the "Bail out!" directive also when it is preceded by leading whitespace. * tests/tap-spurious.test: Remove the tests checking that a "Bail out!" string coming right after leading whitespace does not trigger a bailout action. * tests/tap-bailout-leading-space.test: New test. * tests/list-of-tests.mk: Add it. Problem reported by Jim Meyering in automake bug#10374.
Diffstat (limited to 'lib/tap-driver.sh')
-rwxr-xr-xlib/tap-driver.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh
index c911991c1..c0112983b 100755
--- a/lib/tap-driver.sh
+++ b/lib/tap-driver.sh
@@ -23,7 +23,7 @@
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
-scriptversion=2011-09-28.14; # UTC
+scriptversion=2011-12-27.17; # UTC
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
@@ -573,12 +573,16 @@ while (1)
handle_tap_plan(0, $0)
}
# "Bail out!" magic.
- else if ($0 ~ /^Bail out!/)
+ # Older versions of prove and TAP::Harness (e.g., 3.17) did not
+ # recognize a "Bail out!" directive when preceded by leading
+ # whitespace, but more modern versions (e.g., 3.23) do. So we
+ # emulate the latter, "more modern" behaviour.
+ else if ($0 ~ /^[ \t]*Bail out!/)
{
bailed_out = 1
# Get the bailout message (if any), with leading and trailing
# whitespace stripped. The message remains stored in `$0`.
- sub("^Bail out![ \t]*", "");
+ sub("^[ \t]*Bail out![ \t]*", "");
sub("[ \t]*$", "");
# Format the error message for the
bailout_message = "Bail out!"