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 BF447431FBC
\r
6 for <notmuch@notmuchmail.org>; Thu, 6 Dec 2012 13:12:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.001 tagged_above=-999 required=5
\r
12 tests=[FREEMAIL_FROM=0.001] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id ojjbQ73AnHmn for <notmuch@notmuchmail.org>;
\r
16 Thu, 6 Dec 2012 13:12:27 -0800 (PST)
\r
17 Received: from mail.nexoid.at (www.nexoid.at [178.79.130.240])
\r
18 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 645BF431FAE
\r
21 for <notmuch@notmuchmail.org>; Thu, 6 Dec 2012 13:12:26 -0800 (PST)
\r
22 Received: by mail.nexoid.at (Postfix, from userid 1000)
\r
23 id 453CE11C111; Thu, 6 Dec 2012 22:12:23 +0100 (CET)
\r
24 From: Peter Feigl <craven@gmx.net>
\r
25 To: notmuch@notmuchmail.org
\r
26 Subject: [PATCH v5 4/5] Adding tests for --format=sexp.
\r
27 Date: Thu, 6 Dec 2012 22:12:14 +0100
\r
28 Message-Id: <1354828335-18151-5-git-send-email-craven@gmx.net>
\r
29 X-Mailer: git-send-email 1.8.0
\r
30 In-Reply-To: <1354828335-18151-1-git-send-email-craven@gmx.net>
\r
31 References: <1354828335-18151-1-git-send-email-craven@gmx.net>
\r
33 Content-Type: text/plain; charset=UTF-8
\r
34 Content-Transfer-Encoding: 8bit
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.13
\r
38 List-Id: "Use and development of the notmuch mail system."
\r
39 <notmuch.notmuchmail.org>
\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
41 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
43 List-Post: <mailto:notmuch@notmuchmail.org>
\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
47 X-List-Received-Date: Thu, 06 Dec 2012 21:12:29 -0000
\r
49 Add basic tests, the same as for json, for the S-Expression output
\r
52 test/notmuch-test | 1 +
\r
53 test/sexp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
\r
54 2 files changed, 49 insertions(+)
\r
55 create mode 100755 test/sexp
\r
57 diff --git a/test/notmuch-test b/test/notmuch-test
\r
58 index a6ef34f..ca9c3dc 100755
\r
59 --- a/test/notmuch-test
\r
60 +++ b/test/notmuch-test
\r
61 @@ -31,6 +31,7 @@ TESTS="
\r
69 diff --git a/test/sexp b/test/sexp
\r
70 new file mode 100755
\r
71 index 0000000..b804942
\r
75 +#!/usr/bin/env bash
\r
76 +test_description="--format=sexp output"
\r
79 +test_begin_subtest "Show message: sexp"
\r
80 +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
81 +output=$(notmuch show --format=sexp "sexp-show-message")
\r
82 +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :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
84 +# This should be the same output as above.
\r
85 +test_begin_subtest "Show message: sexp --body=true"
\r
86 +output=$(notmuch show --format=sexp --body=true "sexp-show-message")
\r
87 +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :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
89 +test_begin_subtest "Show message: sexp --body=false"
\r
90 +output=$(notmuch show --format=sexp --body=false "sexp-show-message")
\r
91 +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :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
93 +test_begin_subtest "Search message: sexp"
\r
94 +add_message "[subject]=\"sexp-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"sexp-search-message\""
\r
95 +output=$(notmuch search --format=sexp "sexp-search-message" | notmuch_search_sanitize)
\r
96 +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
98 +test_begin_subtest "Show message: sexp, utf-8"
\r
99 +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
100 +output=$(notmuch show --format=sexp "jsön-show-méssage")
\r
101 +test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :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
103 +test_begin_subtest "Show message: sexp, inline attachment filename"
\r
104 +subject='sexp-show-inline-attachment-filename'
\r
105 +id="sexp-show-inline-attachment-filename@notmuchmail.org"
\r
106 +emacs_deliver_message \
\r
108 + 'This is a test message with inline attachment with a filename' \
\r
109 + "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")
\r
110 + (message-goto-eoh)
\r
111 + (insert \"Message-ID: <$id>\n\")"
\r
112 +output=$(notmuch show --format=sexp "id:$id")
\r
113 +filename=$(notmuch search --output=files "id:$id")
\r
114 +test_expect_equal "$output" "((((:id \"$id\" :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
116 +test_begin_subtest "Search message: sexp, utf-8"
\r
117 +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
118 +output=$(notmuch search --format=sexp "jsön-search-méssage" | notmuch_search_sanitize)
\r
119 +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