unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Peter Feigl <craven@gmx.net>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 4/5] Adding tests for --format=sexp.
Date: Tue,  4 Dec 2012 15:46:21 +0100	[thread overview]
Message-ID: <1354632382-15609-5-git-send-email-craven@gmx.net> (raw)
In-Reply-To: <1354632382-15609-1-git-send-email-craven@gmx.net>
In-Reply-To: <1354264143-30173-1-git-send-email-craven@gmx.net>

Add basic tests, the same as for json, for the S-Expression output
format.
---
 test/notmuch-test |  1 +
 test/sexp         | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100755 test/sexp

diff --git a/test/notmuch-test b/test/notmuch-test
index a6ef34f..ca9c3dc 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -31,6 +31,7 @@ TESTS="
   excludes
   tagging
   json
+  sexp
   text
   multipart
   thread-naming
diff --git a/test/sexp b/test/sexp
new file mode 100755
index 0000000..fdc9de6
--- /dev/null
+++ b/test/sexp
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+test_description="--format=sexp output"
+. ./test-lib.sh
+
+test_begin_subtest "Show message: sexp"
+add_message "[subject]=\"sexp-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]=\"sexp-show-message\""
+output=$(notmuch show --format=sexp "sexp-show-message")
+test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (match t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"inbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (To \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply-To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \"sexp-show-message\n\"))))) ())))"
+
+# This should be the same output as above.
+test_begin_subtest "Show message: sexp --body=true"
+output=$(notmuch show --format=sexp --body=true "sexp-show-message")
+test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (match t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"inbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (To \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply-To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \"sexp-show-message\n\"))))) ())))"
+
+test_begin_subtest "Show message: sexp --body=false"
+output=$(notmuch show --format=sexp --body=false "sexp-show-message")
+test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (match t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"inbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (To \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply-To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:00 +0000\")))) ())))"
+
+test_begin_subtest "Search message: sexp"
+add_message "[subject]=\"sexp-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"sexp-search-message\""
+output=$(notmuch search --format=sexp "sexp-search-message" | notmuch_search_sanitize)
+test_expect_equal "$output" "(((thread \"0000000000000002\") (timestamp 946728000) (date_relative \"2000-01-01\") (matched 1) (total 1) (authors \"Notmuch Test Suite\") (subject \"sexp-search-subject\") (tags (\"inbox\" \"unread\"))))"
+
+test_begin_subtest "Show message: sexp, utf-8"
+add_message "[subject]=\"sexp-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""
+output=$(notmuch show --format=sexp "jsön-show-méssage")
+test_expect_equal "$output" "(((((id \"msg-003@notmuch-test-suite\") (match t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/msg-003\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"inbox\" \"unread\")) (headers ((Subject \"sexp-show-utf8-body-sübjéct\") (From \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (To \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (Date \"Sat, 01 Jan 2000 12:00:00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \"jsön-show-méssage\n\"))))) ())))"
+
+test_begin_subtest "Show message: sexp, inline attachment filename"
+subject='sexp-show-inline-attachment-filename'
+id="sexp-show-inline-attachment-filename@notmuchmail.org"
+emacs_deliver_message \
+    "$subject" \
+    'This is a test message with inline attachment with a filename' \
+    "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")
+     (message-goto-eoh)
+     (insert \"Message-ID: <$id>\n\")"
+output=$(notmuch show --format=sexp "id:$id")
+filename=$(notmuch search --output=files "id:$id")
+test_expect_equal "$output" "(((((id \"sexp-show-inline-attachment-filename@notmuchmail.org\") (match t) (excluded nil) (filename \"$filename\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"inbox\")) (headers ((Subject \"sexp-show-inline-attachment-filename\") (From \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (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\") (filename \"README\")))))))) ())))"
+
+test_begin_subtest "Search message: sexp, utf-8"
+add_message "[subject]=\"sexp-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""
+output=$(notmuch search --format=sexp "jsön-search-méssage" | notmuch_search_sanitize)
+test_expect_equal "$output" "(((thread \"0000000000000005\") (timestamp 946728000) (date_relative \"2000-01-01\") (matched 1) (total 1) (authors \"Notmuch Test Suite\") (subject \"sexp-search-utf8-body-sübjéct\") (tags (\"inbox\" \"unread\"))))"
+
+
+test_done
-- 
1.8.0

  parent reply	other threads:[~2012-12-04 14:46 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-30  8:29 [PATCH 1/3] Adding an S-expression structured output printer Peter Feigl
2012-11-30  8:29 ` [PATCH 2/3] Use the S-Expression structured printer for notmuch search Peter Feigl
2012-11-30 18:04   ` Jani Nikula
2012-11-30  8:29 ` [PATCH 3/3] Use the S-Expression structured printer in notmuch show and notmuch reply Peter Feigl
2012-11-30 19:06   ` Jani Nikula
2012-11-30  8:34 ` [PATCH 1/3] Adding an S-expression structured output printer Peter Feigl
2012-11-30 17:26 ` Jani Nikula
2012-11-30 19:11 ` Jani Nikula
2012-12-01  9:59 ` Mark Walters
2012-12-01 11:34   ` Tomi Ollila
2012-12-01 12:24     ` Mark Walters
2012-12-01 13:29       ` Tomi Ollila
2012-12-01 13:45         ` Mark Walters
2012-12-01 14:26           ` Mark Walters
2012-12-01 15:46             ` Mark Walters
2012-12-01 15:18       ` Austin Clements
2012-12-01 16:14 ` Mark Walters
2012-12-04 14:46 ` [PATCH v2 0/5] New output format sexp (Lisp S-Expressions) Peter Feigl
2012-12-04 17:07   ` Jani Nikula
2012-12-06  7:33   ` [PATCH v3 " Peter Feigl
2012-12-06  8:22     ` Mark Walters
2012-12-07  2:54     ` Jameson Graef Rollins
2012-12-06  7:33   ` [PATCH v3 1/5] Adding an S-expression structured output printer Peter Feigl
2012-12-06  7:33   ` [PATCH v3 2/5] Rename the -json printer functions in notmuch-reply and notmuch-show to generic -sprinter functions Peter Feigl
2012-12-06  7:33   ` [PATCH v3 3/5] Use the S-Expression structured printer in notmuch-show, notmuch-reply and notmuch-search Peter Feigl
2012-12-06  7:33   ` [PATCH v3 4/5] Adding tests for --format=sexp Peter Feigl
2012-12-06  8:18     ` Mark Walters
2012-12-06  7:33   ` [PATCH v3 5/5] Updating man pages for new S-Expression output format Peter Feigl
2012-12-06  8:19     ` Mark Walters
2012-12-04 14:46 ` [PATCH v2 1/5] Adding an S-expression structured output printer Peter Feigl
2012-12-04 19:14   ` Austin Clements
2012-12-04 14:46 ` [PATCH v2 2/5] Rename the -json printer functions in notmuch-reply and notmuch-show to generic -sprinter functions Peter Feigl
2012-12-04 19:18   ` Austin Clements
2012-12-04 14:46 ` [PATCH v2 3/5] Use the S-Expression structured printer in notmuch-show, notmuch-reply and notmuch-search Peter Feigl
2012-12-04 19:22   ` Austin Clements
2012-12-04 14:46 ` Peter Feigl [this message]
2012-12-04 19:24   ` [PATCH v2 4/5] Adding tests for --format=sexp Austin Clements
2012-12-04 14:46 ` [PATCH v2 5/5] Updating man pages for new S-Expression output format Peter Feigl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354632382-15609-5-git-send-email-craven@gmx.net \
    --to=craven@gmx.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).