[PATCH] First tests for JSON output and UTF-8 in mail body and subject
Carl Worth
cworth at cworth.org
Wed Apr 14 17:35:44 PDT 2010
On Tue, 13 Apr 2010 18:37:57 +0200, Gregor Hoffleit <gregor at hoffleit.de> wrote:
> The test suite doesn't yet cover --format=json output nor UTF-8 in
> subject or body.
>
> This patch starts with test cases for 'search --format=json' and
> 'show --format=json'.
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=json '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]="json-search-subject"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="json-search-message"'
> +execute_expecting "search --format=json 'json-search-message'" '[{"thread": "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=json" test above does have the
correct timestamp.
So, a double thanks for this test, it seems to have uncovered another
bug.
-Carl
[*] 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100414/d55ee234/attachment.pgp>
More information about the notmuch
mailing list