X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/b7cbd7c8a39920669db61d331b12839f2a2d3562..86d4dcea853d7e37ff2615b793e3cb5dce7e3af0:/test/mhstore/test-mhstore?ds=inline diff --git a/test/mhstore/test-mhstore b/test/mhstore/test-mhstore index 3db1176e..d3f86b02 100755 --- a/test/mhstore/test-mhstore +++ b/test/mhstore/test-mhstore @@ -16,7 +16,7 @@ fi setup_test -mhstore - >/dev/null 2>&1 || true # gcov +check_exit '-eq 1' mhstore - expected="$MH_TEST_DIR/test-mhstore$$.expected" expected2="$MH_TEST_DIR/test-mhstore$$.expected2" @@ -214,95 +214,14 @@ run_test 'mhstore last -part 1.1 -auto' \ 'storing message 11 part 1.1 as file test1.txt' check "$expected" test1.txt -# check -check -start_test '-check' +# check -outfile - with -file +start_test '-outfile - with -file' cat >"$expected" <<'EOF' This is the second text/plain part. EOF -run_test 'mhstore last -part 2 -check' \ - 'storing message 11 part 2 as file 11.2.txt' -check "$expected" 11.2.txt 'keep first' - -# check with -check on base64 encoded part -start_test 'with -check on base64 encoded part' -cat >"$expected2" <<'EOF' -This is the fourth text/plain part. -This test has multiple lines. -EOF -run_test 'mhstore last -part 4 -check' \ - 'storing message 11 part 4 as file 11.4.txt' -check "$expected2" 11.4.txt - -# check -check with bad MD5 checksum -start_test '-check with bad MD5 checksum' -sed 's/\(Content-MD5: \)kq+Hnc/\1BADBAD/' "$msgfile" >"$MH_TEST_DIR/$$.tmp" -mv -f "$MH_TEST_DIR/$$.tmp" "$msgfile" -run_test 'mhstore last -part 2 -check' \ -'storing message 11 part 2 as file 11.2.txt -mhstore: content integrity suspect (digest mismatch) -- continuing - (content text/plain in message 11, part 2)' -check "$expected" 11.2.txt 'keep first' - -# check -nocheck, the default -start_test '-nocheck, the default' -run_test 'mhstore last -part 2 -check -nocheck' \ - 'storing message 11 part 2 as file 11.2.txt' -check "$expected" 11.2.txt 'keep first' - -# check -outfile - with -file -start_test '-outfile - with -file' run_prog mhstore -noverbose -file `mhpath 11` -part 2 -outfile - >"$actual" 2>&1 check "$expected" "$actual" -# check reassembly of message/partial messages (RFC 1521, 7.3.2) -start_test 'reassembly of message/partial messages (RFC 1521, 7.3.2)' -msgfile=`mhpath new` -cat >"$msgfile" <<'EOF' -To: recipient@example.com -From: sender@example.com -Subject: mhlist test -MIME-Version: 1.0 -Content-Type: message/partial; id="test-mhstore message/partial test"; number=1 - -Content-Type: text/plain; charset="iso-8859-1" - -This is part one of three. -EOF - -msgfile=`mhpath new` -cat >"$msgfile" <<'EOF' -To: recipient@example.com -From: sender@example.com -Subject: mhlist test -MIME-Version: 1.0 -Content-Type: message/partial; id="test-mhstore message/partial test"; number=2 - -This is part two of three. -EOF - -msgfile=`mhpath new` -cat >"$msgfile" <<'EOF' -To: recipient@example.com -From: sender@example.com -Subject: mhlist test -MIME-Version: 1.0 -Content-Type: message/partial; id="test-mhstore message/partial test"; number=3; - total=3 - -This is part three of three. -EOF - -run_test 'mhstore last:3' \ - 'reassembling partials 12,13,14 to folder inbox as message 15' - -cat >"$expected" <<'EOF' -This is part one of three. -This is part two of three. -This is part three of three. -EOF -run_test 'mhstore last' 'storing message 15 as file 15.txt' -check "$expected" 15.txt - # cd into Mail directory because it gets cleaned up by the exit trap. cd Mail @@ -350,9 +269,9 @@ set -e cd .. -# check with relative nmh-storage profile component -start_test 'with relative nmh-storage profile component' -storagedir=storagedir +# check with short relative nmh-storage profile component +start_test 'with short relative nmh-storage profile component' +storagedir=s dir="$MH_TEST_DIR/Mail/inbox/$storagedir" mkdir "$dir" printf '%s\n' "nmh-storage: $storagedir" >>"$MH" @@ -363,6 +282,19 @@ EOF run_test 'mhstore 11 -part 4' \ "storing message 11 part 4 as file $storagedir/11.4.txt" check "$expected" "$dir/11.4.txt" 'keep first' +rmdir "$dir" +sed '$d' "$MH" >"$MH.new" +mv "$MH.new" "$MH" + +# check with relative nmh-storage profile component +start_test 'with relative nmh-storage profile component' +storagedir=storagedir +dir="$MH_TEST_DIR/Mail/inbox/$storagedir" +mkdir "$dir" +printf '%s\n' "nmh-storage: $storagedir" >>"$MH" +run_test 'mhstore 11 -part 4' \ +"storing message 11 part 4 as file $storagedir/11.4.txt" +check "$expected" "$dir/11.4.txt" 'keep first' # check with relative nmh-storage profile component and -auto start_test 'with relative nmh-storage profile component and -auto'