X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT160-json.sh;h=91b98e5d6bdc5bdeccfee989424e1366c9fa5e40;hp=ac51895e826d260601260d6aae1a55bb90138fa9;hb=f33053023b2a3f42ba7d87e3ed58b58673bf08ad;hpb=ab022657776af0bb47e72caf2517464ca59e7d48 diff --git a/test/T160-json.sh b/test/T160-json.sh index ac51895e..91b98e5d 100755 --- a/test/T160-json.sh +++ b/test/T160-json.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash test_description="--format=json output" -. ./test-lib.sh || exit 1 +. $(dirname "$0")/test-lib.sh || exit 1 test_begin_subtest "Show message: json" add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"json-show-message\"" @@ -41,13 +41,13 @@ id="json-show-inline-attachment-filename@notmuchmail.org" emacs_fcc_message \ "$subject" \ 'This is a test message with inline attachment with a filename' \ - "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\") + "(mml-attach-file \"$NOTMUCH_SRCDIR/test/README\" nil nil \"inline\") (message-goto-eoh) (insert \"Message-ID: <$id>\n\")" output=$(notmuch show --format=json "id:$id") filename=$(notmuch search --output=files "id:$id") # Get length of README after base64-encoding, minus additional newline. -attachment_length=$(( $(base64 $TEST_DIRECTORY/README | wc -c) - 1 )) +attachment_length=$(( $(base64 $NOTMUCH_SRCDIR/test/README | wc -c) - 1 )) test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": [\"$filename\"], \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite \", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": $attachment_length, \"content-transfer-encoding\": \"base64\", \"content-disposition\": \"inline\", \"filename\": \"README\"}]}]}, []]]]" test_begin_subtest "Search message: json, utf-8" @@ -71,8 +71,8 @@ test_begin_subtest "Format version: too high" test_expect_code 21 "notmuch search --format-version=999 \\*" test_begin_subtest "Show message: multiple filenames" -add_message "[id]=message-id@example.com [filename]=copy1" -add_message "[id]=message-id@example.com [filename]=copy2" +add_message '[id]=message-id@example.com [filename]=copy1 [date]="Fri, 05 Jan 2001 15:43:52 +0000"' +add_message '[id]=message-id@example.com [filename]=copy2 [date]="Fri, 05 Jan 2001 15:43:52 +0000"' cat < EXPECTED [ [