#!/usr/bin/env bash
test_description="emacs notmuch-show charset handling"
-. ./test-lib.sh
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
UTF8_YEN=$'\xef\xbf\xa5'
BIG5_YEN=$'\xa2\x44'
+test_require_emacs
+
# Add four messages with unusual encoding requirements:
#
# 1) text/plain in quoted-printable big5
cat <<EOF >EXPECTED
Yen: $UTF8_YEN
EOF
-test_expect_equal_file OUTPUT EXPECTED
+test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "8bit text parts are decoded when rendering"
test_emacs '(notmuch-show "id:test-plain-8bit@example.com")
cat <<EOF >EXPECTED
Yen: $UTF8_YEN
EOF
-test_expect_equal_file OUTPUT EXPECTED
+test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "HTML parts are decoded when rendering"
test_emacs '(notmuch-show "id:test-html@example.com")
[ text/html ]
Yen: $UTF8_YEN
EOF
-test_expect_equal_file OUTPUT EXPECTED
+test_expect_equal_file EXPECTED OUTPUT
# Test saving
cat <<EOF >EXPECTED
Yen: =A2=44
EOF
-test_expect_equal_file OUTPUT EXPECTED
+test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "8bit text message are not decoded when viewing"
test_emacs '(notmuch-show "id:test-plain-8bit@example.com")
cat <<EOF >EXPECTED
Yen: $BIG5_YEN
EOF
-test_expect_equal_file OUTPUT EXPECTED
+test_expect_equal_file EXPECTED OUTPUT
test_done