Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / 15 / 0e13fe6c990dc43076145967c0e40b4fb42ede
1 Return-Path: <bremner@tethera.net>\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 EDDF0431FB6\r
6         for <notmuch@notmuchmail.org>; Thu,  6 Dec 2012 17:27:33 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 YZUA09FMexBO for <notmuch@notmuchmail.org>;\r
16         Thu,  6 Dec 2012 17:27:32 -0800 (PST)\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
18         (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 2AC47429E33\r
21         for <notmuch@notmuchmail.org>; Thu,  6 Dec 2012 17:27:14 -0800 (PST)\r
22 Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net\r
23         ([142.167.90.129] helo=zancas.localnet)\r
24         by tesseract.cs.unb.ca with esmtpsa\r
25         (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)\r
26         (envelope-from <bremner@tethera.net>)\r
27         id 1Tgmif-0003Nw-3S; Thu, 06 Dec 2012 21:27:13 -0400\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)\r
29         (envelope-from <bremner@tethera.net>)\r
30         id 1TgmiZ-0004kp-MZ; Thu, 06 Dec 2012 21:27:07 -0400\r
31 From: david@tethera.net\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [Patch v3b 7/9] test: second set of dump/restore --format=batch-tag\r
34         tests\r
35 Date: Thu,  6 Dec 2012 21:26:45 -0400\r
36 Message-Id: <1354843607-17980-8-git-send-email-david@tethera.net>\r
37 X-Mailer: git-send-email 1.7.10.4\r
38 In-Reply-To: <1354843607-17980-1-git-send-email-david@tethera.net>\r
39 References: <1354843607-17980-1-git-send-email-david@tethera.net>\r
40 X-Spam_bar: -\r
41 Cc: David Bremner <bremner@debian.org>\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Fri, 07 Dec 2012 01:27:34 -0000\r
55 \r
56 From: David Bremner <bremner@debian.org>\r
57 \r
58 These one need the completed functionality in notmuch-restore. Fairly\r
59 exotic tags are tested, but no weird message id's.\r
60 \r
61 We test each possible input to autodetection, both explicit (with\r
62 --format=auto) and implicit (without --format).\r
63 ---\r
64  test/dump-restore |   83 +++++++++++++++++++++++++++++++++++++++++++++++++++++\r
65  1 file changed, 83 insertions(+)\r
66 \r
67 diff --git a/test/dump-restore b/test/dump-restore\r
68 index ce81e6f..ff02b29 100755\r
69 --- a/test/dump-restore\r
70 +++ b/test/dump-restore\r
71 @@ -98,6 +98,89 @@ notmuch dump --format=batch-tag from:cworth | sed 's/^.*-- id://' | \\r
72      sort > OUTPUT.$test_count\r
73  test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
74  \r
75 +test_begin_subtest "format=batch-tag, # round-trip"\r
76 +notmuch dump --format=sup | sort > EXPECTED.$test_count\r
77 +notmuch dump --format=batch-tag | notmuch restore --format=batch-tag\r
78 +notmuch dump --format=sup | sort > OUTPUT.$test_count\r
79 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
80 +\r
81 +test_begin_subtest "format=batch-tag, # blank lines and comments"\r
82 +notmuch dump --format=batch-tag| sort > EXPECTED.$test_count\r
83 +notmuch restore <<EOF\r
84 +# this line is a comment; the next has only white space\r
85 +        \r
86 +\r
87 +# the previous line is empty\r
88 +EOF\r
89 +notmuch dump --format=batch-tag | sort > OUTPUT.$test_count\r
90 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
91 +\r
92 +test_begin_subtest "format=batch-tag, # reverse-round-trip empty tag"\r
93 +cat <<EOF >EXPECTED.$test_count\r
94 ++ -- id:20091117232137.GA7669@griffis1.net\r
95 +EOF\r
96 +notmuch restore --format=batch-tag < EXPECTED.$test_count\r
97 +notmuch dump --format=batch-tag id:20091117232137.GA7669@griffis1.net > OUTPUT.$test_count\r
98 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
99 +\r
100 +tag1='comic_swear=$&^%$^%\\//-+$^%$'\r
101 +enc1=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag1")\r
102 +\r
103 +tag2=$(printf 'this\n tag\t has\n spaces')\r
104 +enc2=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag2")\r
105 +\r
106 +enc3='%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a'\r
107 +tag3=$($TEST_DIRECTORY/hex-xcode --direction=decode $enc3)\r
108 +\r
109 +notmuch dump --format=batch-tag > BACKUP\r
110 +\r
111 +notmuch tag +"$tag1" +"$tag2" +"$tag3" -inbox -unread "*"\r
112 +\r
113 +test_begin_subtest 'format=batch-tag, round trip with strange tags'\r
114 +notmuch dump --format=batch-tag > EXPECTED.$test_count\r
115 +notmuch dump --format=batch-tag | notmuch restore --format=batch-tag\r
116 +notmuch dump --format=batch-tag > OUTPUT.$test_count\r
117 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
118 +\r
119 +test_begin_subtest 'format=batch-tag, checking encoded output'\r
120 +notmuch dump --format=batch-tag -- from:cworth |\\r
121 +        awk "{ print \"+$enc1 +$enc2 +$enc3 -- \" \$5 }" > EXPECTED.$test_count\r
122 +notmuch dump --format=batch-tag -- from:cworth  > OUTPUT.$test_count\r
123 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
124 +\r
125 +test_begin_subtest 'restoring sane tags'\r
126 +notmuch restore --format=batch-tag < BACKUP\r
127 +notmuch dump --format=batch-tag > OUTPUT.$test_count\r
128 +test_expect_equal_file BACKUP OUTPUT.$test_count\r
129 +\r
130 +test_begin_subtest 'format=batch-tag, restore=auto'\r
131 +notmuch dump --format=batch-tag > EXPECTED.$test_count\r
132 +notmuch tag -inbox -unread "*"\r
133 +notmuch restore --format=auto < EXPECTED.$test_count\r
134 +notmuch dump --format=batch-tag > OUTPUT.$test_count\r
135 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
136 +\r
137 +test_begin_subtest 'format=sup, restore=auto'\r
138 +notmuch dump --format=sup > EXPECTED.$test_count\r
139 +notmuch tag -inbox -unread "*"\r
140 +notmuch restore --format=auto < EXPECTED.$test_count\r
141 +notmuch dump --format=sup > OUTPUT.$test_count\r
142 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
143 +\r
144 +test_begin_subtest 'format=batch-tag, restore=default'\r
145 +notmuch dump --format=batch-tag > EXPECTED.$test_count\r
146 +notmuch tag -inbox -unread "*"\r
147 +notmuch restore < EXPECTED.$test_count\r
148 +notmuch dump --format=batch-tag > OUTPUT.$test_count\r
149 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
150 +\r
151 +test_begin_subtest 'format=sup, restore=default'\r
152 +notmuch dump --format=sup > EXPECTED.$test_count\r
153 +notmuch tag -inbox -unread "*"\r
154 +notmuch restore < EXPECTED.$test_count\r
155 +notmuch dump --format=sup > OUTPUT.$test_count\r
156 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
157 +\r
158  test_begin_subtest 'roundtripping random message-ids and tags'\r
159  \r
160      ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG}\r
161 -- \r
162 1.7.10.4\r
163 \r