]> diplodocus.org Git - nmh/blobdiff - test/comp/test-comp-format
getpass.c: Move interface to own file.
[nmh] / test / comp / test-comp-format
index 34c9cb982b0c33ca3768fd8eb2e3af7be2db38f2..a7bc502f1eac411ba2e035b1f22a1aac403cdf2e 100755 (executable)
@@ -13,7 +13,33 @@ fi
 
 setup_test
 
 
 setup_test
 
-comp - >/dev/null 2>&1 || true  # gcov
+check_exit '-eq 1' comp -
+check_exit '-eq 1' comp -xyzzy
+check_exit '-eq 0' comp -help
+check_exit '-eq 0' comp -version
+check_exit '-eq 1' comp -build -noedit -editor
+check_exit '-eq 1' comp -whatnowproc
+check_exit '-eq 1' comp -whatnowproc '' -
+check_exit '-eq 1' comp -use -nouse -form
+check_exit '-eq 1' comp -file
+check_exit '-eq 1' comp -file foo -file
+check_exit '-eq 1' comp -nodraftfolder -draftfolder
+check_exit '-eq 1' comp -draftfolder foo -draftfolder
+check_exit '-eq 1' comp -draftmessage
+check_exit '-eq 1' comp -draftmessage foo -draftmessage
+check_exit '-eq 1' comp -to
+check_exit '-eq 1' comp -cc
+check_exit '-eq 1' comp -from
+check_exit '-eq 1' comp -fcc
+check_exit '-eq 1' comp -fcc @ -
+check_exit '-eq 1' comp -width
+check_exit '-eq 1' comp -width 0
+check_exit '-eq 1' comp -subject
+check_exit '-eq 1' comp + @
+check_exit '-eq 1' comp 42 314
+check_exit '-eq 1' comp -form foo 42
+check_exit '-eq 1' comp +
+check_exit '-eq 1' comp 42
 
 #
 # Create a test template file (we create one here just in case the master
 
 #
 # Create a test template file (we create one here just in case the master
@@ -43,6 +69,7 @@ fcc1="+nosuchmailbox"
 fcc2="+nosuchmailbox2"
 subject="Totally bogus subject"
 
 fcc2="+nosuchmailbox2"
 subject="Totally bogus subject"
 
+start_test 'check -from, -to, -cc, -fcc, and -subject switches'
 cat > $expected <<EOF
 From: ${from}
 To: ${to1},
 cat > $expected <<EOF
 From: ${from}
 To: ${to1},
@@ -55,14 +82,42 @@ Fcc: ${fcc1}, ${fcc2}
 Subject: ${subject}
 --------
 EOF
 Subject: ${subject}
 --------
 EOF
-
 run_prog \
 comp -editor true -form "${form}" -from "${from}" -to "${to1}" -to "${to2}" \
     -cc "${cc1}" -cc "${cc2}" -cc "${cc3}" -cc "${cc4}" -fcc "${fcc1}" \
     -fcc "${fcc2}" -subject "${subject}" -width 60 -nowhatnowproc || exit 1
 run_prog \
 comp -editor true -form "${form}" -from "${from}" -to "${to1}" -to "${to2}" \
     -cc "${cc1}" -cc "${cc2}" -cc "${cc3}" -cc "${cc4}" -fcc "${fcc1}" \
     -fcc "${fcc2}" -subject "${subject}" -width 60 -nowhatnowproc || exit 1
+check "${expected}" "${actual}"
+
 
 
+start_test 'check -fcc with no fcc in components'
+cat > $form <<EOF
+%<{from}%|%(void(localmbox))%>%(void(width))%(putaddr From: )
+%<{to}%(void(width))%(putaddr To: )%|To:%>
+%<{cc}%(void(width))%(putaddr cc: )%|cc:%>
+Subject:%<{subject} %(putstr)%>
+--------
+EOF
+#### There won't be an Fcc: header because there isn't one in the components.
+cat > $expected <<EOF
+From: ${from}
+To: ${to1},
+    ${to2}
+cc: ${cc1},
+    ${cc2},
+    ${cc3},
+    ${cc4}
+Subject: ${subject}
+--------
+EOF
+
+run_prog \
+comp -editor true -form "${form}" -from "${from}" -to "${to1}" -to "${to2}" \
+    -cc "${cc1}" -cc "${cc2}" -cc "${cc3}" -cc "${cc4}" -fcc "${fcc1}" \
+    -fcc "${fcc2}" -subject "${subject}" -width 60 -nowhatnowproc || exit 1
 check "${expected}" "${actual}"
 
 check "${expected}" "${actual}"
 
+
 test "${failed:-0}" -eq 0 && rm "${form}"
 
 test "${failed:-0}" -eq 0 && rm "${form}"
 
+finish_test
 exit $failed
 exit $failed