Re: [PATCH] First tests for JSON output and UTF-8 in mail body and subject
authorCarl Worth <cworth@cworth.org>
Thu, 15 Apr 2010 00:35:44 +0000 (17:35 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:39 +0000 (09:36 -0800)
99/29cc69d63cbd11b82cf7e78e7293c2cd51c839 [new file with mode: 0644]

diff --git a/99/29cc69d63cbd11b82cf7e78e7293c2cd51c839 b/99/29cc69d63cbd11b82cf7e78e7293c2cd51c839
new file mode 100644 (file)
index 0000000..46ee262
--- /dev/null
@@ -0,0 +1,124 @@
+Return-Path: <cworth@cworth.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 2F2B64196F2\r
+       for <notmuch@notmuchmail.org>; Wed, 14 Apr 2010 17:35:46 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.89\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5\r
+       tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01]\r
+       autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id d9jt62db+Z8r; Wed, 14 Apr 2010 17:35:45 -0700 (PDT)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 58206431FC1;\r
+       Wed, 14 Apr 2010 17:35:45 -0700 (PDT)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id 02E6E568DE1; Wed, 14 Apr 2010 17:35:45 -0700 (PDT)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: Gregor Hoffleit <gregor@hoffleit.de>, notmuch <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH] First tests for JSON output and UTF-8 in mail body and\r
+       subject\r
+In-Reply-To: <1271176622-sup-4680@sam.mediasupervision.de>\r
+References: <1267697893-sup-4538@sam.mediasupervision.de>\r
+       <87r5mje55l.fsf@yoom.home.cworth.org>\r
+       <1271176622-sup-4680@sam.mediasupervision.de>\r
+Date: Wed, 14 Apr 2010 17:35:44 -0700\r
+Message-ID: <87iq7tft7j.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 15 Apr 2010 00:35:46 -0000\r
+\r
+--=-=-=\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Tue, 13 Apr 2010 18:37:57 +0200, Gregor Hoffleit <gregor@hoffleit.de> wr=\r
+ote:\r
+> The test suite doesn't yet cover --format=3Djson output nor UTF-8 in\r
+> subject or body.\r
+>=20\r
+> This patch starts with test cases for 'search --format=3Djson' and\r
+> 'show --format=3Djson'.\r
+\r
+Thanks for the tests, Gregor!\r
+\r
+I was about to push this, but first noticed that I hadn't run the test\r
+suite in the last day and that it had recently broken (oops!). I fixed\r
+that, but then also noticed that I got failures with your tests.\r
+\r
+\r
+> +execute_expecting "show --format=3Djson 'json-show-message'" '[[[{"id":\r
+> "'${gen_msg_id}'", "match": true, "filename": "'${gen_msg_filename}'",\r
+> "date_unix": 946728000, "date_relative": "2000-01-01", "tags":\r
+...\r
+> +printf " Search message: json...\t"\r
+> +add_message '[subject]=3D"json-search-subject"' '[date]=3D"Sat, 01 Jan 2=\r
+000 12:00:00 -0000"' '[body]=3D"json-search-message"'\r
+> +execute_expecting "search --format=3Djson 'json-search-message'" '[{"thr=\r
+ead": "XXX",\r
+> +"timestamp": 946724400,\r
+\r
+I'm getting a timestamp value here of 946756800 which is clearly an\r
+interpretation of the above date as if it were my local time zone. That\r
+is:\r
+\r
+       $ date -u +%s -d "Sat, 01 Jan 2000 12:00:00 -0800"\r
+       946756800\r
+\r
+And the value you have appears to have been generated in your timezone:\r
+\r
+       $ date -u +%s -d "Sat, 01 Jan 2000 12:00:00 +0100"\r
+       946724400\r
+\r
+Meanwhile, the value that should be printed here[*] is the value from\r
+interpreting the original date in the timezone explicitly specified in\r
+that date:\r
+\r
+       $ date -u +%s -d "Sat, 01 Jan 2000 12:00:00 -0000"\r
+       946728000\r
+\r
+Note that the "notmuch show --format=3Djson" test above does have the\r
+correct timestamp.\r
+\r
+So, a double thanks for this test, it seems to have uncovered another\r
+bug.\r
+\r
+=2DCarl\r
+\r
+[*] I say "should" because I don't believe we have any actual\r
+specification of the data coming out of the JSON output yet. One other\r
+thing that seems odd is the name of "date_unix" in the show output and\r
+"timestamp" in the search output for what is effectively the same\r
+field.\r
+\r
+\r
+\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFLxl9g6JDdNq8qSWgRAtS3AJ0XQoqOytRvOrmILHtm2KHWM0d1OACgiXXm\r
+4notoObIRxHor9YNu9BcLh8=\r
+=wgSz\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r