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