X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/b7cbd7c8a39920669db61d331b12839f2a2d3562..7540f02725475698a47046ebf4e55b3e8dea5ab6:/test/anno/test-anno?ds=sidebyside diff --git a/test/anno/test-anno b/test/anno/test-anno index f47ae2de..7216327c 100755 --- a/test/anno/test-anno +++ b/test/anno/test-anno @@ -16,7 +16,24 @@ fi setup_test -anno - >/dev/null 2>&1 || true # gcov +check_exit '-eq 1' anno - +check_exit '-eq 1' anno -comp +check_exit '-eq 1' anno -comp foo -comp bar +check_exit '-eq 1' anno -text +check_exit '-eq 1' anno -text foo -text bar +check_exit '-eq 1' anno -number 0 +check_exit '-eq 1' anno -number -number +check_exit '-eq 1' anno + @ +check_exit '-eq 1' anno -draft 42 +check_exit '-eq 1' anno -draft -list "$expected" <"$actual" 2>&1 +run_prog anno -help 2>&1 | sed '/^$/,$d' >"$actual" check "$expected" "$actual" # check -version +start_test "-version" case `anno -v` in anno\ --*) ;; * ) printf '%s: anno -v generated unexpected output\n' "$0" >&2 @@ -53,11 +72,13 @@ case `anno -v` in esac # check unknown switch +start_test "unknown switch" run_test "anno -nonexistent" 'anno: -nonexistent unknown' cat "${MH_TEST_DIR}/Mail/inbox/1" >"${MH_TEST_DIR}/Mail/inbox/11" # check with no switches +start_test "with no switches" printf 'Nmh-test:\n' >"$expected" cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected" folder -fast 1 >/dev/null @@ -68,18 +89,21 @@ check "$expected" "$actual" 'keep first' cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -component +start_test "-component" run_prog anno -component Nmh-test sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual" check "$expected" "$actual" 'keep first' cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check +folder +start_test "+folder" run_prog anno -component Nmh-test +inbox sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual" check "$expected" "$actual" 'keep first' cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check msg +start_test "msg" folder -fast 2 >/dev/null run_prog anno 1 -component Nmh-test sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual" @@ -89,6 +113,7 @@ cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" check_for_hard_links if [ $hard_links_supported -eq 1 ]; then # check -noinplace + start_test "-noinplace" # Hard link the message and verify that the new one doesn't get annotated. cp "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.copy" ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link" @@ -98,6 +123,7 @@ if [ $hard_links_supported -eq 1 ]; then 'keep first' # check -inplace + start_test "-inplace" # Hard link the message and verify that the new one does get annotated. ln "${MH_TEST_DIR}/Mail/inbox/8" "${MH_TEST_DIR}/Mail/inbox/8.link" run_prog anno 8 -component Nmh-test -noinplace -inplace @@ -105,6 +131,7 @@ if [ $hard_links_supported -eq 1 ]; then fi # check -nodate. Without -text, it doesn't change the message. +start_test "-nodate. Without -text, it doesn't change the message." cp -f "${MH_TEST_DIR}/Mail/inbox/11" "$expected-nodate" run_prog anno 1 -component Nmh-test -nodate cp -f "${MH_TEST_DIR}/Mail/inbox/1" "$actual" @@ -112,12 +139,14 @@ check "$expected-nodate" "$actual" cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -date +start_test "-date" run_prog anno 1 -component Nmh-test -nodate -date sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/inbox/1" >"$actual" check "$expected" "$actual" 'keep first' cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -draft. +start_test "-draft." cp -f "${MH_TEST_DIR}/Mail/inbox/1" "${MH_TEST_DIR}/Mail/draft" run_prog anno -draft -component Nmh-test sed -e 's/^Nmh-test:.*/Nmh-test:/' "${MH_TEST_DIR}/Mail/draft" >"$actual" @@ -125,6 +154,7 @@ check "$expected" "$actual" rm "${MH_TEST_DIR}/Mail/draft" # check -append +start_test "-append" sed -e 's/\(Subject: Testing message 1\)/\1\ Nmh-test:/' <"${MH_TEST_DIR}/Mail/inbox/1" >"$expected" run_prog anno 1 -component Nmh-test -append @@ -133,15 +163,18 @@ check "$expected" "$actual" cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -list +start_test "-list" printf 'Nmh-test: test of anno -list\n' >"$expected" cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected" run_prog anno 1 -component Nmh-test -nodate -text 'test of anno -list' run_test 'anno 1 -component Nmh-test -list' 'test of anno -list' # check -text +start_test "-text" check "$expected" "${MH_TEST_DIR}/Mail/inbox/1" cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -list -number +start_test "-list -number" printf 'Nmh-test: test of anno -list -number\n' >"$expected" cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected" run_prog anno 1 -component Nmh-test -nodate -text 'test of anno -list -number' @@ -151,6 +184,7 @@ check "$expected" "${MH_TEST_DIR}/Mail/inbox/1" cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -delete +start_test "-delete" cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected" run_prog anno 1 -component Nmh-test run_prog anno 1 -component Nmh-test -delete @@ -159,6 +193,7 @@ check "$expected" "$actual" cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -delete -number +start_test "-delete -number" printf 'Nmh-test: 1\nNmh-test: 3\n' >"$expected" cat "${MH_TEST_DIR}/Mail/inbox/1" >>"$expected" run_prog anno 1 -component Nmh-test -nodate -text 3 @@ -170,6 +205,7 @@ check "$expected" "$actual" cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -delete -all +start_test "-delete -all" cp "${MH_TEST_DIR}/Mail/inbox/1" "$expected" run_prog anno 1 -component Nmh-test -nodate -text 3 run_prog anno 1 -component Nmh-test -nodate -text 2 @@ -180,6 +216,7 @@ check "$expected" "$actual" cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -preserve +start_test "-preserve" touch -t '201210010000.00' "${MH_TEST_DIR}/Mail/inbox/1" ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1" run_prog anno 1 -component Nmh-test -preserve @@ -189,6 +226,7 @@ check "$actual-ls1" "$actual-ls2" cp -f "${MH_TEST_DIR}/Mail/inbox/11" "${MH_TEST_DIR}/Mail/inbox/1" # check -nopreserve +start_test "-nopreserve" touch -t '2012100100.00' "${MH_TEST_DIR}/Mail/inbox/1" ls -l "${MH_TEST_DIR}/Mail/inbox/1" >"$actual-ls1" run_prog anno 1 -component Nmh-test -preserve -nopreserve @@ -201,4 +239,5 @@ set -e rm "$actual-ls1" "$actual-ls2" +finish_test exit ${failed:-0}