X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/d7e3ab62b9c2fdf720c9350660abb9d8d67dd5af..bcf252dfcdd7db22634ee483b457167eebf81951:/test/mhshow/test-textcharset?ds=sidebyside diff --git a/test/mhshow/test-textcharset b/test/mhshow/test-textcharset index c1a69d10..4768808a 100755 --- a/test/mhshow/test-textcharset +++ b/test/mhshow/test-textcharset @@ -20,9 +20,12 @@ if test "$ICONV_ENABLED" -eq 0; then test_skip 'test-textcharset requires that nmh have been built with iconv' fi +LC_ALL=en_US.UTF-8; export LC_ALL + expected="$MH_TEST_DIR"/$$.expected actual="$MH_TEST_DIR"/$$.actual +# check charset conversion msgfile=`mhpath new` cat >"$msgfile" <"$expected" <"$actual" 2>&1 +run_prog mhshow -nopause last >"$actual" 2>&1 check "$expected" "$actual" -# Check -textcharset. +cat >>"$MH" <<'EOF' +mhshow-show-text/plain: echo %{charset} +EOF + +# check expansion of %{charset} by itself +msgfile=`mhpath new` +cat >"$msgfile" <"$expected" <"$actual" 2>&1 -check "$expected" "$actual" 'keep first' +run_prog mhshow -nopause last >"$actual" 2>&1 +check "$expected" "$actual" + +# check expansion of empty %{charset} by itself +msgfile=`mhpath new` +cat >"$msgfile" <"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + +grep -v 'mhshow-show-text/plain:' "$MH" >"$MH.new" +mv -f "$MH.new" "$MH" +cat >>"$MH" <<'EOF' +mhshow-show-text/plain: echo `ap -format '%(void(lit %{charset}))%<(nonnull)-I %(putstr)%>' 0` +EOF + +# check expansion of embedded %{charset} with no text following +cat >"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + +# check expansion of empty embedded %{charset} with no text following +cat >"$expected" <"$actual" 2>&1 check "$expected" "$actual" +sed -e 's%\(mhshow-show-text/plain:.*\)%\1 file%' "$MH" >"$MH.new" +mv -f "$MH.new" "$MH" + +# check expansion of embedded %{charset} with text following +cat >"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + +# check expansion of empty embedded %{charset} with text following +cat >"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + +sed -e 's/%{charset}/%{unknown}/' "$MH" >"$MH.new" +mv -f "$MH.new" "$MH" + +# check expansion of unknown parameter +msgfile=`mhpath new` +cat >"$msgfile" <"$expected" <"$actual" 2>&1 +check "$expected" "$actual" + + exit $failed