From 1af5da59464f700ce154b26d88a402e3c51301e8 Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Sun, 30 Oct 2016 00:03:34 +0100 Subject: [PATCH] Fix test-header-parsing test script. It was using sh's backticks that chomped the last linefeed! Add comment referencing the commit that fixed the code this is testing. Have fewer test cases, sticking to just one or two character headers with empty or one-character bodies. Avoids slowing the tests too much and the fixed bug was to do with hashing one-character headers. --- Makefile.am | 1 - test/scan/test-header-parsing | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 978e5721..8aecc8b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -113,7 +113,6 @@ TESTS = test/ali/test-ali test/anno/test-anno \ test/cleanup ## The "cleanup" test should always be last. XFAIL_TESTS = \ - test/scan/test-header-parsing \ # check_SCRIPTS = test/common.sh diff --git a/test/scan/test-header-parsing b/test/scan/test-header-parsing index 37b3b048..48da05e6 100755 --- a/test/scan/test-header-parsing +++ b/test/scan/test-header-parsing @@ -1,5 +1,9 @@ #!/bin/sh +# Test short headers and short bodies. +# One-character long headers used to sometimes be missed; see commit +# 41a82a7ecba04be5b27b3ffc813e2f34d2786a38. + set -e if test -z "${MH_OBJ_DIR}"; then @@ -14,17 +18,17 @@ setup_test mail="$MH_TEST_DIR/$$.mail" expected="$MH_TEST_DIR/$$.expected" actual="$MH_TEST_DIR/$$.actual" +format="$MH_TEST_DIR/$$.format" -for a in a: a:1 a:12 aa: aa:1 aa:12 aaa: aaa:1 aaa:12 aaaa: aaaa:1 aaaa:12; do - for b in b: b:1 b:12 bb: bb:1 bb:12 bbb: bbb:1 bbb:12 bbbb: bbbb:1 bbbb:12; do - for c in c: c:1 c:12 cc: cc:1 cc:12 ccc: ccc:1 ccc:12 cccc: cccc:1 cccc:12; do +for a in a: a:1 aa: aa:1; do + for b in b: b:1 bb: bb:1; do + for c in c: c:1 cc: cc:1; do printf '%s\n%s\n%s\n' $a $b $c >"$mail" sed 's/.*://' "$mail" >"$expected" - f="`sed 's/:.*/}/; s/^/%{/' "$mail"`" - run_prog scan -forma "$f" -file "$mail" >"$actual" || + sed 's/:.*/}/; s/^/%{/' "$mail" >"$format" + run_prog scan -form "$format" -file "$mail" >"$actual" || exit 1 check "$expected" "$actual" - break 3 # Fails on first iteration! done done done -- 2.56.0