notmuch.el: controlling what does and doesn't get expanded in searches
[notmuch-archives.git] / 60 / 5624c062aab36f16100e227be446aa42ea0afa
1 Return-Path: <bremner@tesseract.cs.unb.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 87BA6431FBC\r
6         for <notmuch@notmuchmail.org>; Mon,  9 Dec 2013 05:38:05 -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 agHqtPHX1qth for <notmuch@notmuchmail.org>;\r
16         Mon,  9 Dec 2013 05:38:04 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 9E36C431FDE\r
21         for <notmuch@notmuchmail.org>; Mon,  9 Dec 2013 05:37:52 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1Vq11z-0003FZ-QH; Mon, 09 Dec 2013 09:37:51 -0400\r
25 Received: (nullmailer pid 27760 invoked by uid 1000); Mon, 09 Dec 2013\r
26         13:37:22 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [Patch v2 2/4] test: sanitize Date and timestamp fields in json\r
30 Date: Mon,  9 Dec 2013 21:36:29 +0800\r
31 Message-Id: <1386596191-27683-2-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 1.8.4.3\r
33 In-Reply-To: <1386596191-27683-1-git-send-email-david@tethera.net>\r
34 References: <1386517946-22054-1-git-send-email-david@tethera.net>\r
35         <1386596191-27683-1-git-send-email-david@tethera.net>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Mon, 09 Dec 2013 13:38:05 -0000\r
49 \r
50 Eventually we want test messages to have distinct dates to avoid\r
51 reproducability problems. This sanitization will prevent some test\r
52 failures when that change is made.\r
53 \r
54 Replace the use of a local function in maildir-sync with\r
55 notmuch_json_show_sanitize\r
56 ---\r
57  test/maildir-sync | 15 +++++----------\r
58  test/test-lib.sh  |  4 +++-\r
59  2 files changed, 8 insertions(+), 11 deletions(-)\r
60 \r
61 diff --git a/test/maildir-sync b/test/maildir-sync\r
62 index 33d2c58..3186e70 100755\r
63 --- a/test/maildir-sync\r
64 +++ b/test/maildir-sync\r
65 @@ -4,11 +4,6 @@ test_description="maildir synchronization"\r
66  \r
67  . ./test-lib.sh\r
68  \r
69 -# Avoid including the local value of MAIL_DIR in the result.\r
70 -filter_show_json() {\r
71 -    sed -e "s|${MAIL_DIR}/|MAIL_DIR/|"\r
72 -}\r
73 -\r
74  # Create the expected maildir structure\r
75  mkdir $MAIL_DIR/cur\r
76  mkdir $MAIL_DIR/new\r
77 @@ -40,18 +35,18 @@ output=$(cd ${MAIL_DIR}/cur; ls -1 adding-replied*)\r
78  test_expect_equal "$output" "adding-replied-tag:2,RS"\r
79  \r
80  test_begin_subtest "notmuch show works with renamed file (without notmuch new)"\r
81 -output=$(notmuch show --format=json id:${gen_msg_id} | filter_show_json)\r
82 -test_expect_equal_json "$output" '[[[{"id": "adding-replied-tag@notmuch-test-suite",\r
83 +output=$(notmuch show --format=json id:${gen_msg_id} | notmuch_json_show_sanitize)\r
84 +test_expect_equal_json "$output" '[[[{"id": "XXXXX",\r
85  "match": true,\r
86  "excluded": false,\r
87 -"filename": "MAIL_DIR/cur/adding-replied-tag:2,RS",\r
88 -"timestamp": 978709437,\r
89 +"filename": "YYYYY",\r
90 +"timestamp": 42,\r
91  "date_relative": "2001-01-05",\r
92  "tags": ["inbox","replied"],\r
93  "headers": {"Subject": "Adding replied tag",\r
94  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
95  "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
96 -"Date": "Fri, 05 Jan 2001 15:43:57 +0000"},\r
97 +"Date": "GENERATED_DATE"},\r
98  "body": [{"id": 1,\r
99  "content-type": "text/plain",\r
100  "content": "This is just a test message (#3)\n"}]},\r
101 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
102 index 8611ba5..8f18e73 100644\r
103 --- a/test/test-lib.sh\r
104 +++ b/test/test-lib.sh\r
105 @@ -625,7 +625,9 @@ notmuch_json_show_sanitize ()\r
106  {\r
107      sed \\r
108         -e 's|"id": "[^"]*",|"id": "XXXXX",|g' \\r
109 -       -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g'\r
110 +       -e 's|"Date": "Fri, 05 Jan 2001 [^"]*0000"|"Date": "GENERATED_DATE"|g' \\r
111 +       -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g' \\r
112 +       -e 's|"timestamp": 97.......|"timestamp": 42|g'\r
113  }\r
114  \r
115  notmuch_emacs_error_sanitize ()\r
116 -- \r
117 1.8.4.3\r
118 \r