X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/7e288a9d7941d2d9df94f9ee70e47061f0f36304..d9b33232b6e3b03d7ff0b67e28e82ee455e00d99:/test/mhshow/test-subpart diff --git a/test/mhshow/test-subpart b/test/mhshow/test-subpart index 28bca944..d5ca6100 100755 --- a/test/mhshow/test-subpart +++ b/test/mhshow/test-subpart @@ -20,6 +20,24 @@ setup_test expected=$MH_TEST_DIR/$$.expected actual=$MH_TEST_DIR/$$.actual +mhn_defaults="$MH_INST_DIR${nmhetcdir}/mhn.defaults" + +if grep mhfixmsg-format-text/html "${mhn_defaults}" >/dev/null; then + can_reformat_texthtml=1 + if grep 'mhfixmsg-format-text/html.*w3m' "${mhn_defaults}" \ + >/dev/null; then + #### w3m uses $HOME/.w3m/, and creates it if it doesn't exist. To + #### support testing with non-writeable $HOME, and to not leave + #### relics from this test if it is writeable but doesn't already + #### have a .w3m, and to not depend on whatever is in that if it + #### does already exist, overwrite $HOME if using w3m. + HOME="$MHTMPDIR"; export HOME + fi +else + echo "$0: skipping html checks because no text browser was found" + can_reformat_texthtml=0 +fi + # Write message with a text/plain subpart. msgfile=`mhpath new` msgnum=`basename $msgfile` @@ -57,6 +75,7 @@ This is the text/plain part. EOF # check it +start_test 'text/plain part' run_prog mhshow -part 1.1 -form mhl.null $msgnum > $actual 2>&1 check "$expected" "$actual" : part 1.1 @@ -75,7 +94,7 @@ Content-type: multipart/alternative; boundary="BoundaryAlternative1" --BoundaryAlternative1 -Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-type: text/plain; charset=US-ASCII; format=flowed Content-transfer-encoding: 8bit This is the body text/plain part. @@ -108,15 +127,19 @@ This is the final text/plain signature part. EOF # Write the expected output. -cat > $expected < $expected < $actual 2>&1 -check "$expected" "$actual" : part 1.1.1 + # check it + start_test 'text/html part' + run_prog mhshow -part 1.1.1 -form mhl.null $msgnum 2>&1 | + squeeze_whitespace >$actual + check "$expected" "$actual" : part 1.1.1 +fi # Write the expected output. cat > $expected < $actual 2>&1 check "$expected" "$actual" : part 1.2 @@ -137,6 +161,7 @@ This is the body text/plain part. EOF # check it +start_test 'conflicting text/plain, part 1 switches' run_prog mhshow -prefer text/plain -part 1 -form mhl.null $msgnum > $actual 2>&1 check "$expected" "$actual" : part conflicting text/plain, part 1 switches @@ -149,6 +174,7 @@ This is the final text/plain signature part. EOF # check it +start_test 'final text/plain part' run_prog mhshow -part 2 -form mhl.null $msgnum > $actual 2>&1 check "$expected" "$actual" : part 2 @@ -163,6 +189,7 @@ This is the final text/plain signature part. EOF # check it +start_test 'all text/plain parts' run_prog mhshow -type text/plain -form mhl.null $msgnum > $actual 2>&1 check "$expected" "$actual" : type text/plain @@ -176,7 +203,10 @@ _______________________________________________ This is the final text/plain signature part. EOF +start_test 'prefer text/plain' run_prog mhshow -prefer text/plain -form mhl.null $msgnum > $actual 2>&1 check "$expected" "$actual" : prefer text/plain + +finish_test exit $failed