summaryrefslogtreecommitdiff
path: root/test/system/helpers.bash
diff options
context:
space:
mode:
Diffstat (limited to 'test/system/helpers.bash')
-rw-r--r--test/system/helpers.bash7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 514ba249e..112b73962 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -376,7 +376,12 @@ function parse_table() {
while read col; do
dprint "col=<<$col>>"
row+=("$col")
- done < <(echo "$line" | tr '|' '\012' | sed -e 's/^ *//' -e 's/\\/\\\\/g')
+ done < <(echo "$line" | sed -E -e 's/(^|\s)\|(\s|$)/\n /g' | sed -e 's/^ *//' -e 's/\\/\\\\/g')
+ # the above seds:
+ # 1) Convert '|' to newline, but only if bracketed by spaces or
+ # at beginning/end of line (this allows 'foo|bar' in tests);
+ # 2) then remove leading whitespace;
+ # 3) then double-escape all backslashes
printf "%q " "${row[@]}"
printf "\n"