]> diplodocus.org Git - nmh/blobdiff - test/folder/test-sortm
Use C's `++', `+=', etc., not the longhand.
[nmh] / test / folder / test-sortm
index 0753ecb0f4d90f404c29c20b1bc5a93881758149..a136faaa14d37f55e08e9f278d5285e13ffecd04 100755 (executable)
@@ -16,6 +16,8 @@ fi
 
 setup_test
 
 
 setup_test
 
+check_exit '-eq 1' sortm -
+
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
@@ -37,7 +39,8 @@ Usage: sortm [+folder] [msgs] [switches]
   -help
 EOF
 
   -help
 EOF
 
-sortm -help >"$actual" 2>&1
+#### Skip nmh intro text.
+run_prog sortm -help | sed '/^$/,$d' >"$actual" 2>&1
 check "$expected" "$actual"
 
 # check -version
 check "$expected" "$actual"
 
 # check -version
@@ -83,8 +86,8 @@ cat >"$expected" <<EOF
   12  09/29 Test11             Re: common subject<<This is message number 11 >>
 EOF
 
   12  09/29 Test11             Re: common subject<<This is message number 11 >>
 EOF
 
-sortm
-scan >"$actual"
+run_prog sortm
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check +folder
 check "$expected" "$actual"
 
 # check +folder
@@ -104,8 +107,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile first +inbox; folder -pack >/dev/null
 EOF
 
 refile first +inbox; folder -pack >/dev/null
-sortm +inbox
-scan >"$actual"
+run_prog sortm +inbox
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -verbose
 check "$expected" "$actual"
 
 # check -verbose
@@ -138,8 +141,8 @@ message 1 becomes message 2
 EOF
 
 refile first +inbox; folder -pack >/dev/null
 EOF
 
 refile first +inbox; folder -pack >/dev/null
-sortm -verbose >"$actual"
-scan >>"$actual"
+run_prog sortm -verbose >"$actual"
+scan -width 80 >>"$actual"
 check "$expected" "$actual"
 
 # check -noverbose
 check "$expected" "$actual"
 
 # check -noverbose
@@ -159,8 +162,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile first +inbox; folder -pack >/dev/null
 EOF
 
 refile first +inbox; folder -pack >/dev/null
-sortm -verbose -noverbose >"$actual"
-scan >>"$actual"
+run_prog sortm -verbose -noverbose >"$actual"
+scan -width 80 >>"$actual"
 check "$expected" "$actual"
 
 # check msgs
 check "$expected" "$actual"
 
 # check msgs
@@ -180,8 +183,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile first +inbox; folder -pack >/dev/null
 EOF
 
 refile first +inbox; folder -pack >/dev/null
-sortm first last
-scan >"$actual"
+run_prog sortm first last
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -datefield
 check "$expected" "$actual"
 
 # check -datefield
@@ -200,8 +203,8 @@ cat >"$expected" <<EOF
   12+ 09/29 Test1              Testing message 1<<This is message number 1 >>
 EOF
 
   12+ 09/29 Test1              Testing message 1<<This is message number 1 >>
 EOF
 
-sortm -datefield Alt-Date 1 11
-scan >"$actual"
+run_prog sortm -datefield Alt-Date 1 11
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -textfield subject (datefield major, subjects grouped)
 check "$expected" "$actual"
 
 # check -textfield subject (datefield major, subjects grouped)
@@ -220,8 +223,8 @@ cat >"$expected" <<EOF
   12+ 09/29 Test1              Testing message 1<<This is message number 1 >>
 EOF
 
   12+ 09/29 Test1              Testing message 1<<This is message number 1 >>
 EOF
 
-sortm -textfield subject
-scan >"$actual"
+run_prog sortm -textfield subject
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -nolimit
 check "$expected" "$actual"
 
 # check -nolimit
@@ -240,8 +243,8 @@ cat >"$expected" <<EOF
   12+ 09/29 Test1              Testing message 1<<This is message number 1 >>
 EOF
 
   12+ 09/29 Test1              Testing message 1<<This is message number 1 >>
 EOF
 
-sortm -textfield subject -limit 0 -nolimit
-scan >"$actual"
+run_prog sortm -textfield subject -limit 0 -nolimit
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -textfield subject -limit 0 (subject sort)
 check "$expected" "$actual"
 
 # check -textfield subject -limit 0 (subject sort)
@@ -261,8 +264,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield subject -limit 0
-scan >"$actual"
+run_prog sortm -textfield subject -limit 0
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -textfield -limit 0 (text sort)
 check "$expected" "$actual"
 
 # check -textfield -limit 0 (text sort)
@@ -282,8 +285,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield from -limit 0
-scan >"$actual"
+run_prog sortm -textfield from -limit 0
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -textfield with finite -limit that doesn't cover message 13
 check "$expected" "$actual"
 
 # check -textfield with finite -limit that doesn't cover message 13
@@ -313,8 +316,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield subject -limit 10
-scan >"$actual"
+run_prog sortm -textfield subject -limit 10
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -textfield with finite -limit that does cover message 13
 check "$expected" "$actual"
 
 # check -textfield with finite -limit that does cover message 13
@@ -335,8 +338,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield subject -limit 60
-scan >"$actual"
+run_prog sortm -textfield subject -limit 60
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -notextfield
 check "$expected" "$actual"
 
 # check -notextfield
@@ -357,8 +360,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
 EOF
 
 refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
-sortm -textfield subject -limit 60 -notextfield
-scan >"$actual"
+run_prog sortm -textfield subject -limit 60 -notextfield
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -noall
 check "$expected" "$actual"
 
 # check -noall
@@ -382,8 +385,8 @@ cat >"$expected" <<EOF
 EOF
 
 refile first +inbox; folder -pack >/dev/null
 EOF
 
 refile first +inbox; folder -pack >/dev/null
-sortm -noall -all
-scan >"$actual"
+run_prog sortm -noall -all
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -check
 check "$expected" "$actual"
 
 # check -check
@@ -394,7 +397,7 @@ EOF
 
 sed -e 's/Sep//' $MH_TEST_DIR/Mail/inbox/7 > $MH_TEST_DIR/Mail/inbox/14
 set +e
 
 sed -e 's/Sep//' $MH_TEST_DIR/Mail/inbox/7 > $MH_TEST_DIR/Mail/inbox/14
 set +e
-sortm -check >"$actual" 2>&1
+run_prog sortm -check >"$actual" 2>&1
 set -e
 check "$expected" "$actual"
 
 set -e
 check "$expected" "$actual"
 
@@ -414,7 +417,7 @@ cat >"$expected" <<EOF
   13  10/31 Test13             Re: common subject<<This is message number 13 >>
   14  01/00 Test9              Testing message 9<<This is message number 9 >>
 EOF
   13  10/31 Test13             Re: common subject<<This is message number 13 >>
   14  01/00 Test9              Testing message 9<<This is message number 9 >>
 EOF
-scan >"$actual"
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 # check -nocheck
 check "$expected" "$actual"
 
 # check -nocheck
@@ -439,7 +442,7 @@ sed -e 's/Sep//' $MH_TEST_DIR/Mail/inbox/7 > $MH_TEST_DIR/Mail/inbox/14
 run_test 'sortm -check -nocheck' \
          "sortm: can't parse date field in message 14, will use file \
 modification time"
 run_test 'sortm -check -nocheck' \
          "sortm: can't parse date field in message 14, will use file \
 modification time"
-scan >"$actual"
+scan -width 80 >"$actual"
 check "$expected" "$actual"
 
 
 check "$expected" "$actual"