summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent R. Spillner <kspillner@acm.org>2013-12-13 22:01:47 -0600
committerAndreas Gruenbacher <agruen@linbit.com>2013-12-14 07:31:47 +0100
commit5ecd3ece7f77afc3dc127ad3ae7fc8082e5e6566 (patch)
tree5b013b010039e4f2b8ccb5e756fcd19aa9c9bd31
parent497979e561e880fb0d11be82c78544e5718d531b (diff)
downloadquilt-5ecd3ece7f77afc3dc127ad3ae7fc8082e5e6566.tar.gz
test: ignore leading whitespace in wc output.
POSIX-compliant implementations of wc right-justify each column of output in 7 character wide columns. Tests that verify the output of wc -l should take into account the number of digits in the line count and add the appropriate padding. Therefore, in order for the tests to pass with both POSIX-compliant and non-POSIX-compliant implementations of wc tests should match wc output against patterns with optional whitespace prefixes. Signed-off-by: Kent R. Spillner <kspillner@acm.org>
-rw-r--r--test/remove-trailing-ws.test32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/remove-trailing-ws.test b/test/remove-trailing-ws.test
index cb93b52..bea48a0 100644
--- a/test/remove-trailing-ws.test
+++ b/test/remove-trailing-ws.test
@@ -134,21 +134,21 @@ $ %{QUILT_DIR}/scripts/remove-trailing-ws < unified.diff > unified-wsok.diff
> Removing trailing whitespace from lines 12,16 of files/complex
> Removing trailing whitespace from lines 1,2,3 of files/create
$ wc -l files/add
-> 8 files/add
+>~ (\s+)?8 files/add
$ wc -l files/change
-> 3 files/change
+>~ (\s+)?3 files/change
$ wc -l files/complex
-> 21 files/complex
+>~ (\s+)?21 files/complex
$ wc -l files/create
-> 3 files/create
+>~ (\s+)?3 files/create
$ wc -l files/remove
-> 6 files/remove
+>~ (\s+)?6 files/remove
$ wc -l files/remove-at-end
-> 8 files/remove-at-end
+>~ (\s+)?8 files/remove-at-end
$ wc -l unified.diff
-> 85 unified.diff
+>~ (\s+)?85 unified.diff
$ wc -l unified-wsok.diff
-> 85 unified-wsok.diff
+>~ (\s+)?85 unified-wsok.diff
$ diff -u unified.diff unified-wsok.diff | grep '^++[^+]'
> ++Line 4
> ++to
@@ -167,21 +167,21 @@ $ %{QUILT_DIR}/scripts/remove-trailing-ws < context.diff > context-wsok.diff
> Removing trailing whitespace from lines 12,16 of files/complex
> Removing trailing whitespace from lines 1,2,3 of files/create
$ wc -l files/add
-> 8 files/add
+>~ (\s+)?8 files/add
$ wc -l files/change
-> 3 files/change
+>~ (\s+)?3 files/change
$ wc -l files/complex
-> 21 files/complex
+>~ (\s+)?21 files/complex
$ wc -l files/create
-> 3 files/create
+>~ (\s+)?3 files/create
$ wc -l files/remove
-> 6 files/remove
+>~ (\s+)?6 files/remove
$ wc -l files/remove-at-end
-> 8 files/remove-at-end
+>~ (\s+)?8 files/remove-at-end
$ wc -l context.diff
-> 104 context.diff
+>~ (\s+)?104 context.diff
$ wc -l context-wsok.diff
-> 104 context-wsok.diff
+>~ (\s+)?104 context-wsok.diff
$ diff -u context.diff context-wsok.diff | grep '^+[+!] '
> ++ Line 4
> ++ create