[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH] test: ignore leading whitespace in wc output.
From: |
Kent R. Spillner |
Subject: |
[Quilt-dev] [PATCH] test: ignore leading whitespace in wc output. |
Date: |
Fri, 13 Dec 2013 22:01:47 -0600 |
User-agent: |
OpenSMTPD enqueuer (Demoostik) |
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 <address@hidden>
---
test/remove-trailing-ws.test | 32 ++++++++++++++++----------------
1 file 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
--
1.8.4.3
- [Quilt-dev] [PATCH] test: ignore leading whitespace in wc output.,
Kent R. Spillner <=