]> diplodocus.org Git - nmh/commitdiff
Filter test output to remove added whitespace.
authorDavid Levine <levinedl@acm.org>
Fri, 19 Jan 2018 00:03:52 +0000 (19:03 -0500)
committerDavid Levine <levinedl@acm.org>
Fri, 19 Jan 2018 00:03:52 +0000 (19:03 -0500)
Ralph noticed that lynx added whitespace to the (empty) converted
html document, breaking the test.

Fix to commit 47629e9e87a324531be881cebfca38dd38f8afaa.

test/common.sh.in
test/mhshow/test-subpart
test/mhshow/test-textcharset

index e866033..8c054cd 100644 (file)
@@ -175,6 +175,12 @@ squeeze_lines() {
   sed '/^$/N;/\n$/D'
 }
 
+#### Filter that removes blank lines and leading space that lynx inserts.
+#### but sufficient for our purpose.
+squeeze_whitespace() {
+  sed '/^$/D; s/^ *//;'
+}
+
 #### Filter that converts non-breakable space U+00A0 to an ASCII space.
 prepare_space() {
   sed 's/'"`printf '\\302\\240'`"'/ /g'
index 2a79977..9529e8e 100755 (executable)
@@ -136,9 +136,8 @@ EOF
 
   # check it
   start_test 'text/html part'
-  # The sed command removes blank lines and leading space that lynx inserts.
   run_prog mhshow -part 1.1.1 -form mhl.null $msgnum |
-      sed '/^$/D; s/^ *//;' > $actual 2>&1
+      squeeze_whitespace > $actual 2>&1
   check "$expected" "$actual" : part 1.1.1
 fi
 
index 78500a5..68d6b34 100755 (executable)
@@ -319,7 +319,7 @@ cat >"$expected" <<EOF
 [ part  - text/html -   0B  ]
 EOF
 
-run_prog mhshow -noheader -form mhl.null last >"$actual" 2>&1
+run_prog mhshow -noheader -form mhl.null last | squeeze_whitespace >"$actual" 2>&1
 check "$expected" "$actual" : malicious parameter value quoting
 
 #