setup_test
+check_exit '-eq 1' sortm - # gcov
+
expected=$MH_TEST_DIR/$$.expected
actual=$MH_TEST_DIR/$$.actual
-help
EOF
-run_prog sortm -help >"$actual" 2>&1
+#### Skip nmh intro text.
+run_prog sortm -help | sed '/^$/,$d' >"$actual" 2>&1
check "$expected" "$actual"
# check -version
EOF
run_prog sortm
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check +folder
refile first +inbox; folder -pack >/dev/null
run_prog sortm +inbox
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -verbose
refile first +inbox; folder -pack >/dev/null
run_prog sortm -verbose >"$actual"
-scan >>"$actual"
+scan -width 80 >>"$actual"
check "$expected" "$actual"
# check -noverbose
refile first +inbox; folder -pack >/dev/null
run_prog sortm -verbose -noverbose >"$actual"
-scan >>"$actual"
+scan -width 80 >>"$actual"
check "$expected" "$actual"
# check msgs
refile first +inbox; folder -pack >/dev/null
run_prog sortm first last
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -datefield
EOF
run_prog sortm -datefield Alt-Date 1 11
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -textfield subject (datefield major, subjects grouped)
EOF
run_prog sortm -textfield subject
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -nolimit
EOF
run_prog sortm -textfield subject -limit 0 -nolimit
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -textfield subject -limit 0 (subject sort)
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
run_prog sortm -textfield subject -limit 0
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -textfield -limit 0 (text sort)
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
run_prog sortm -textfield from -limit 0
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -textfield with finite -limit that doesn't cover message 13
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
run_prog sortm -textfield subject -limit 10
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -textfield with finite -limit that does cover message 13
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
run_prog sortm -textfield subject -limit 60
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -notextfield
refile 2-7 +inbox; refile 1 +inbox; folder -pack last >/dev/null
run_prog sortm -textfield subject -limit 60 -notextfield
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -noall
refile first +inbox; folder -pack >/dev/null
run_prog sortm -noall -all
-scan >"$actual"
+scan -width 80 >"$actual"
check "$expected" "$actual"
# check -check
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
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"