1 Return-Path: <awg@lagos.xvx.ca>
\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 08110431FBD
\r
6 for <notmuch@notmuchmail.org>; Sat, 13 Jul 2013 17:46:15 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 0zaa0ruuFfTJ for <notmuch@notmuchmail.org>;
\r
16 Sat, 13 Jul 2013 17:46:07 -0700 (PDT)
\r
17 Received: from smtp-out-04.shaw.ca (smtp-out-04.shaw.ca [64.59.134.12])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 72F3A431FBC
\r
19 for <notmuch@notmuchmail.org>; Sat, 13 Jul 2013 17:46:07 -0700 (PDT)
\r
20 X-Cloudmark-SP-Filtered: true
\r
21 X-Cloudmark-SP-Result: v=1.1 cv=YO+FcVZrxpdWV6Mo6AkY2Rtp7tuV51ZJEd1ZQZEmJbs=
\r
23 a=6-n1HIq2qTAA:10 a=BLceEmwcHowA:10 a=gumk1giGF0obp6xRQyl7Yg==:17
\r
24 a=7cLX10yMaAZXQ6iEbqEA:9 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
\r
25 Received: from unknown (HELO lagos.xvx.ca) ([68.150.39.45])
\r
26 by smtp-out-04.shaw.ca with ESMTP; 13 Jul 2013 18:46:06 -0600
\r
27 Received: by lagos.xvx.ca (Postfix, from userid 1000)
\r
28 id 138BC8009323; Sat, 13 Jul 2013 18:46:06 -0600 (MDT)
\r
29 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>
\r
30 To: notmuch@notmuchmail.org
\r
31 Subject: [PATCH 3/3] test: Add simple tests for the add command
\r
32 Date: Sat, 13 Jul 2013 18:45:46 -0600
\r
33 Message-Id: <1373762746-22308-4-git-send-email-awg+notmuch@xvx.ca>
\r
34 X-Mailer: git-send-email 1.7.9.5
\r
35 In-Reply-To: <1373762746-22308-1-git-send-email-awg+notmuch@xvx.ca>
\r
36 References: <1373762746-22308-1-git-send-email-awg+notmuch@xvx.ca>
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Sun, 14 Jul 2013 00:46:15 -0000
\r
52 test/insert | 35 +++++++++++++++++++++++++++++++++++
\r
53 1 file changed, 35 insertions(+)
\r
55 diff --git a/test/insert b/test/insert
\r
56 index 021edb6..eb23e02 100755
\r
59 @@ -18,6 +18,14 @@ gen_insert_msg() {
\r
60 "[body]=\"insert-message\""
\r
64 + generate_message \
\r
65 + "[dir]=add-messages/cur" \
\r
66 + "[subject]=\"add-subject\"" \
\r
67 + "[body]=\"add-message\"" \
\r
68 + "[id]=\"add-message\""
\r
71 test_expect_code 1 "Insert zero-length file" \
\r
72 "notmuch insert < /dev/null"
\r
74 @@ -118,4 +126,31 @@ gen_insert_msg
\r
75 test_expect_code 1 "Insert message, create invalid subfolder" \
\r
76 "notmuch insert --folder=../G --create-folder $gen_msg_filename"
\r
79 +tmp_filename=/tmp/$(basename $gen_msg_filename)
\r
80 +mv $gen_msg_filename $tmp_filename
\r
81 +notmuch add $tmp_filename
\r
82 +test_expect_code 1 "Add message from outside maildir returns 1" \
\r
83 + "notmuch add $tmp_filename"
\r
85 +test_begin_subtest "Add message from outside maildir does nothing"
\r
86 +output=$(notmuch count id:$gen_msg_id)
\r
87 +test_expect_equal "$output" "0"
\r
89 +test_begin_subtest "Add message from inside maildir"
\r
91 +notmuch add $gen_msg_filename
\r
92 +output=$(notmuch count id:$gen_msg_id)
\r
93 +test_expect_equal "$output" "1"
\r
95 +test_begin_subtest "Add duplicate message"
\r
97 +notmuch add "$gen_msg_filename"
\r
98 +output=$(notmuch search --output=files "id:$gen_msg_id" | wc -l)
\r
99 +test_expect_equal "$output" 2
\r
101 +test_begin_subtest "Adding duplicate message does not change tags"
\r
102 +output=$(notmuch search --format=json --output=tags "id:$gen_msg_id")
\r
103 +test_expect_equal_json "$output" '["inbox", "unread"]'
\r