1 Return-Path: <nex@nexoid.at>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 496D5431FC3
\r
6 for <notmuch@notmuchmail.org>; Wed, 5 Dec 2012 23:33:30 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=0.001 tagged_above=-999 required=5
\r
13 tests=[FREEMAIL_FROM=0.001] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id jVp-7T4miuH9 for <notmuch@notmuchmail.org>;
\r
17 Wed, 5 Dec 2012 23:33:28 -0800 (PST)
\r
18 Received: from mail.nexoid.at (www.nexoid.at [178.79.130.240])
\r
19 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 4537B431FAE
\r
22 for <notmuch@notmuchmail.org>; Wed, 5 Dec 2012 23:33:20 -0800 (PST)
\r
23 Received: by mail.nexoid.at (Postfix, from userid 1000)
\r
24 id B74CF11C110; Thu, 6 Dec 2012 08:33:12 +0100 (CET)
\r
25 From: Peter Feigl <craven@gmx.net>
\r
26 To: notmuch@notmuchmail.org
\r
27 Subject: [PATCH v3 4/5] Adding tests for --format=sexp.
\r
28 Date: Thu, 6 Dec 2012 08:33:08 +0100
\r
29 Message-Id: <1354779189-12231-5-git-send-email-craven@gmx.net>
\r
30 X-Mailer: git-send-email 1.8.0
\r
31 In-Reply-To: <1354779189-12231-1-git-send-email-craven@gmx.net>
\r
32 References: <1354779189-12231-1-git-send-email-craven@gmx.net>
\r
33 In-Reply-To: <1354632382-15609-1-git-send-email-craven@gmx.net>
\r
34 References: <1354632382-15609-1-git-send-email-craven@gmx.net>
\r
36 Content-Type: text/plain; charset=UTF-8
\r
37 Content-Transfer-Encoding: 8bit
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Thu, 06 Dec 2012 07:33:30 -0000
\r
52 Add basic tests, the same as for json, for the S-Expression output
\r
55 test/notmuch-test | 1 +
\r
56 test/sexp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
\r
57 2 files changed, 49 insertions(+)
\r
58 create mode 100755 test/sexp
\r
60 diff --git a/test/notmuch-test b/test/notmuch-test
\r
61 index a6ef34f..ca9c3dc 100755
\r
62 --- a/test/notmuch-test
\r
63 +++ b/test/notmuch-test
\r
64 @@ -31,6 +31,7 @@ TESTS="
\r
72 diff --git a/test/sexp b/test/sexp
\r
73 new file mode 100755
\r
74 index 0000000..335844e
\r
78 +#!/usr/bin/env bash
\r
79 +test_description="--format=sexp output"
\r
82 +test_begin_subtest "Show message: sexp"
\r
83 +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\""
\r
84 +output=$(notmuch show --format=sexp "sexp-show-message")
\r
85 +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\"))) ())))"
\r
87 +# This should be the same output as above.
\r
88 +test_begin_subtest "Show message: sexp --body=true"
\r
89 +output=$(notmuch show --format=sexp --body=true "sexp-show-message")
\r
90 +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\"))) ())))"
\r
92 +test_begin_subtest "Show message: sexp --body=false"
\r
93 +output=$(notmuch show --format=sexp --body=false "sexp-show-message")
\r
94 +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\")) ())))"
\r
96 +test_begin_subtest "Search message: sexp"
\r
97 +add_message "[subject]=\"sexp-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"sexp-search-message\""
\r
98 +output=$(notmuch search --format=sexp "sexp-search-message" | notmuch_search_sanitize)
\r
99 +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\")))"
\r
101 +test_begin_subtest "Show message: sexp, utf-8"
\r
102 +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\""
\r
103 +output=$(notmuch show --format=sexp "jsön-show-méssage")
\r
104 +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\"))) ())))"
\r
106 +test_begin_subtest "Show message: sexp, inline attachment filename"
\r
107 +subject='sexp-show-inline-attachment-filename'
\r
108 +id="sexp-show-inline-attachment-filename@notmuchmail.org"
\r
109 +emacs_deliver_message \
\r
111 + 'This is a test message with inline attachment with a filename' \
\r
112 + "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")
\r
113 + (message-goto-eoh)
\r
114 + (insert \"Message-ID: <$id>\n\")"
\r
115 +output=$(notmuch show --format=sexp "id:$id")
\r
116 +filename=$(notmuch search --output=files "id:$id")
\r
117 +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\"))))) ())))"
\r
119 +test_begin_subtest "Search message: sexp, utf-8"
\r
120 +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\""
\r
121 +output=$(notmuch search --format=sexp "jsön-search-méssage" | notmuch_search_sanitize)
\r
122 +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\")))"
\r