From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D28A9431FB6 for ; Sat, 4 May 2013 09:23:11 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 Ruj34YxJdC50 for ; Sat, 4 May 2013 09:23:08 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A6E8A431FAF for ; Sat, 4 May 2013 09:23:07 -0700 (PDT) Received: by mail-lb0-f173.google.com with SMTP id t10so2375074lbi.32 for ; Sat, 04 May 2013 09:23:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:x-gm-message-state; bh=QesV6RgIEyHENxdxJ4jr47k+hh309GFqojK05iPa3oM=; b=A/7QrkVAB45Efg7BEPuT8893k1k3qJC+6pQOjZDtqZ4DstFUJIAIukGA91pxmjQ9lN /I4J6lo5/3+pK7vxQtdthzIcu5JxZKOc96easlZ48CUwuxY9coClm2p2XkMRm54f4n3M NhhRRX7BcPDi+5V0y3ScukTSgQmVo87RRY05mqZTPGeVKRohlz9lhbQ7t9YUa7j1IZso d6/+Hd/bXu4vrLRlJKpzvC5Y3/HBLD76lURwjTMbTfZGjT4HaA1ZzH+5dZ1Cf/8x4Td+ +adwK2saB3S6/bcfLO0EHjAshvWUpR+KwTUJFNiKvrCY7a/v/eIuLqBFJkS1OgJB2Z/5 qjpA== X-Received: by 10.112.137.73 with SMTP id qg9mr5789472lbb.3.1367684586153; Sat, 04 May 2013 09:23:06 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c376-211.dhcp.inet.fi. [88.195.118.211]) by mx.google.com with ESMTPSA id rn10sm5824440lbb.16.2013.05.04.09.23.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 04 May 2013 09:23:05 -0700 (PDT) From: Jani Nikula To: Aaron Ecay , notmuch@notmuchmail.org Subject: Re: [PATCH 1/2] test: add tests for the handling of References and In-Reply-To headers In-Reply-To: <1362540709-28765-1-git-send-email-aaronecay@gmail.com> References: <87ppzfzxuk.fsf@zancas.localnet> <1362540709-28765-1-git-send-email-aaronecay@gmail.com> User-Agent: Notmuch/0.15.2+87~gc69f540 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Sat, 04 May 2013 19:23:00 +0300 Message-ID: <87txmi1zq3.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain X-Gm-Message-State: ALoCoQm3/685lEZ9wykLYzdVl9f8jhiD2fVl5WKx4rCFvXT2qVnARSQP8hA6KFT6VIc4wJjl/5fH 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: Sat, 04 May 2013 16:23:12 -0000 On Wed, 06 Mar 2013, Aaron Ecay wrote: > These tests are known_broken, the following commit fixes them. > --- > > Thanks to David and Tomi for pointing out test_expect_equal_json. In > the process of implementing that, I discovered > notmuch_json_show_sanitize, which I had also not been using. This > patch fixes the test to use both these conveniences. The second patch > is not changed substantively, but I am resending it for tidiness. > > test/thread-replies | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 144 insertions(+) > create mode 100755 test/thread-replies > > diff --git a/test/thread-replies b/test/thread-replies > new file mode 100755 > index 0000000..a902691 > --- /dev/null > +++ b/test/thread-replies > @@ -0,0 +1,144 @@ > +#!/usr/bin/env bash > +# > +# Copyright (c) 2013 Aaron Ecay > +# > + > +test_description='test of proper handling of in-reply-to and references headers > + > +This test makes sure that the thread structure in the notmuch database is > +constructed properly, even in the presence of non-RFC-compliant headers' Nitpick, most other tests have one line test descriptions. The second paragraph could be left as comment. > + > +. ./test-lib.sh > + > +test_begin_subtest "Use References when In-Reply-To is broken" > +test_subtest_known_broken > +add_message '[id]="foo@one.com"' \ > + '[subject]=one' > +add_message '[in-reply-to]="mumble"' \ > + '[references]=""' \ > + '[subject]="Re: one"' > +output=$(notmuch show --format=json 'subject:one' | notmuch_json_show_sanitize) > +expected='[[[{"id": "foo@one.com", > + "match": true, > + "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-001", Please replace the path with: "filename": "YYYYY", Ditto below for all of them. > + "timestamp": 978709437, > + "date_relative": "2001-01-05", > + "tags": ["inbox", "unread"], > + "headers": {"Subject": "one", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, > + "body": [{"id": 1, > + "content-type": "text/plain", > + "content": "This is just a test message (#1)\n"}]}, > + [[{"id": "msg-002@notmuch-test-suite", > + "match": true, "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-002", > + "timestamp": 978709437, "date_relative": "2001-01-05", > + "tags": ["inbox", "unread"], "headers": {"Subject": "Re: one", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, > + "body": [{"id": 1, "content-type": "text/plain", > + "content": "This is just a test message (#2)\n"}]}, []]]]]]' > +expected=`echo "$expected" | notmuch_json_show_sanitize` > +test_expect_equal_json "$output" "$expected" > + > +test_begin_subtest "Prefer References to In-Reply-To" > +test_subtest_known_broken > +add_message '[id]="foo@two.com"' \ > + '[subject]=two' > +add_message '[in-reply-to]=""' \ > + '[references]=""' \ > + '[subject]="Re: two"' > +output=$(notmuch show --format=json 'subject:two' | notmuch_json_show_sanitize) > +expected='[[[{"id": "foo@two.com", > + "match": true, "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-003", > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], > + "headers": {"Subject": "two", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, > + "body": [{"id": 1, "content-type": "text/plain", > + "content": "This is just a test message (#3)\n"}]}, > + [[{"id": "msg-004@notmuch-test-suite", "match": true, "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-004", > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], > + "headers": {"Subject": "Re: two", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, > + "body": [{"id": 1, > + "content-type": "text/plain", "content": "This is just a test message (#4)\n"}]}, > + []]]]]]' > +expected=`echo "$expected" | notmuch_json_show_sanitize` > +test_expect_equal_json "$output" "$expected" > + > +test_begin_subtest "Use In-Reply-To when no References" > +test_subtest_known_broken As David said, this is not broken currently, as In-Reply-To is used unconditionally. Just drop the broken annotation, the test itself is useful. > +add_message '[id]="foo@three.com"' \ > + '[subject]="three"' > +add_message '[in-reply-to]=""' \ > + '[subject]="Re: three"' > +output=$(notmuch show --format=json 'subject:three' | notmuch_json_show_sanitize) > +expected='[[[{"id": "foo@three.com", "match": true, "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-005", > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], > + "headers": {"Subject": "three", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, > + "content-type": "text/plain", "content": "This is just a test message (#5)\n"}]}, > + [[{"id": "msg-006@notmuch-test-suite", "match": true, "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-006", > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], > + "headers": {"Subject": "Re: three", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, > + "content-type": "text/plain", "content": "This is just a test message (#6)\n"}]}, > + []]]]]]' > +expected=`echo "$expected" | notmuch_json_show_sanitize` > +test_expect_equal_json "$output" "$expected" > + > +test_begin_subtest "Use last Reference" > +test_subtest_known_broken > +add_message '[id]="foo@four.com"' \ > + '[subject]="four"' > +add_message '[id]="bar@four.com"' \ > + '[subject]="not-four"' > +add_message '[in-reply-to]=""' \ > + '[references]=" "' \ > + '[subject]="neither"' > +output=$(notmuch show --format=json 'subject:four' | notmuch_json_show_sanitize) > +expected='[[[{"id": "foo@four.com", "match": true, "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-007", > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], > + "headers": {"Subject": "four", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, > + "content-type": "text/plain", "content": "This is just a test message (#7)\n"}]}, > + [[{"id": "msg-009@notmuch-test-suite", "match": false, "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-009", > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], > + "headers": {"Subject": "neither", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, > + "content-type": "text/plain", "content": "This is just a test message (#9)\n"}]}, > + []]]]], [[{"id": "bar@four.com", "match": true, "excluded": false, > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-008", > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"], > + "headers": {"Subject": "not-four", > + "From": "Notmuch Test Suite ", > + "To": "Notmuch Test Suite ", > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1, > + "content-type": "text/plain", "content": "This is just a test message (#8)\n"}]}, []]]]' > +expected=`echo "$expected" | notmuch_json_show_sanitize` > +test_expect_equal_json "$output" "$expected" > + > + > +test_done > -- > 1.8.1.5 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch