diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2011-08-25 13:22:58 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2011-08-25 13:56:35 +0200 |
commit | e698ee3ea801e1a02263516d75bc4fb1f25e7b3c (patch) | |
tree | 61d5bbc1f30b9c2872b91bbaa18f1f7f1c5e3173 /lib/tap-driver.sh | |
parent | a5b9cae78ce16229fd1cdc7459b08be60bdd6c72 (diff) | |
download | automake-e698ee3ea801e1a02263516d75bc4fb1f25e7b3c.tar.gz |
tap/awk: allow escaping of TAP directives
* lib/tap-driver.sh (setup_result_obj): Handle escaping of TAP
directives in a way tat is (mostly) compatible by what is done
by the TAP::Parser module.
With this change, the tests `tap-escape-directive.test' and
`tap-escape-directive-2.test' now also pass with the shell/awk
implementation of the TAP driver.
Diffstat (limited to 'lib/tap-driver.sh')
-rwxr-xr-x | lib/tap-driver.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh index 535bc2b9b..44317d9de 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-08-25.10; # UTC +scriptversion=2011-08-25.11; # UTC # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. @@ -382,7 +382,6 @@ function setup_result_obj(line) result_obj["directive"] = "" result_obj["explanation"] = "" - # TODO: maybe we should allow a way to escape "#"? if (index(line, "#") == 0) return # No possible directive, nothing more to do. @@ -398,6 +397,20 @@ function setup_result_obj(line) if (!pos) return + # Let`s now see if the TAP directive has been escaped. For example: + # escaped: ok \# SKIP + # not escaped: ok \\# SKIP + # escaped: ok \\\\\# SKIP + # not escaped: ok \ # SKIP + if (substr(line, pos, 1) == "#") + { + bslash_count = 0 + for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--) + bslash_count += 1 + if (bslash_count % 2) + return # Directive was escaped. + } + # Strip the directive and its explanation (if any) from the test # description. result_obj["description"] = substr(line, 1, pos - 1) |