[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {test-protocols} tap/awk: allow escaping of TAP directives
From: |
Stefano Lattarini |
Subject: |
[FYI] {test-protocols} tap/awk: allow escaping of TAP directives |
Date: |
Thu, 25 Aug 2011 14:00:17 +0200 |
* 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.
---
ChangeLog | 10 ++++++++++
lib/tap-driver.sh | 17 +++++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7177583..e407d89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-08-25 Stefano Lattarini <address@hidden>
+ 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.
+
+2011-08-25 Stefano Lattarini <address@hidden>
+
coverage: more about escaping of TAP directives
* tests/tap-escape-directive.test: Make grepping of testsuite
progress output slightly stricter.
diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh
index 535bc2b..44317d9 100755
--- a/lib/tap-driver.sh
+++ b/lib/tap-driver.sh
@@ -23,7 +23,7 @@
# bugs to <address@hidden> or send patches to
# <address@hidden>.
-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)
--
1.7.2.3
- [FYI] {test-protocols} tap/awk: remove obsolete "FIXME" comment, Stefano Lattarini, 2011/08/25
- [FYI] {test-protocols} tap/perl: add copyright notice, version string, and emacs stuff, Stefano Lattarini, 2011/08/25
- [FYI] {test-protocols} tap/awk: don't redirect awk stderr to log files, Stefano Lattarini, 2011/08/25
- [FYI] {test-protocols} tap/perl: don't redirect perl warnings/errors to log files, Stefano Lattarini, 2011/08/25
- [FYI] {test-protocols} tap: improve syncing between awk+shell and perl implementations, Stefano Lattarini, 2011/08/25
- [FYI] {test-protocols} coverage: more about escaping of TAP directives, Stefano Lattarini, 2011/08/25
- [FYI] {test-protocols} tap/awk: allow escaping of TAP directives,
Stefano Lattarini <=