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 8AA1C431FAF for ; Sun, 16 Dec 2012 07:51:14 -0800 (PST) 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 5JofUNcTbHY6 for ; Sun, 16 Dec 2012 07:51:12 -0800 (PST) Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU [18.7.68.37]) by olra.theworths.org (Postfix) with ESMTP id 3E6FF431FAE for ; Sun, 16 Dec 2012 07:51:12 -0800 (PST) X-AuditID: 12074425-b7f606d0000008ea-a9-50cdedef0c3a Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP id 94.54.02282.FEDEDC05; Sun, 16 Dec 2012 10:51:11 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qBGFpAnM028400; Sun, 16 Dec 2012 10:51:11 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qBGFp8ER004550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sun, 16 Dec 2012 10:51:09 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1TkGUe-0000lQ-AP; Sun, 16 Dec 2012 10:51:08 -0500 From: Austin Clements To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH v2 3/4] test: notmuch search --format=text0 In-Reply-To: <5c881edb2803e613e8726f71fe86772d372b38a0.1355064714.git.jani@nikula.org> References: <5c881edb2803e613e8726f71fe86772d372b38a0.1355064714.git.jani@nikula.org> User-Agent: Notmuch/0.14+184~gc26cc51 (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Sun, 16 Dec 2012 10:51:08 -0500 Message-ID: <87y5gyvvv7.fsf@awakening.csail.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hTV1n3/9myAwbNtOhZN050trt+cyezA 5HHr/mt2j2erbjEHMEVx2aSk5mSWpRbp2yVwZRzufctWcFO8ovvzBbYGxj6RLkYODgkBE4n2 vQVdjJxAppjEhXvr2boYuTiEBPYxSiw4+YUNJCEksIFR4uZbJ4jERSaJa02dTBDOEkaJiTP+ MINUsQloSGzbv5wRxBYRsJI49/A1C4gtLGAvsb59P9gkToEwiQctXxghptZIHJhxmRHkClGB eImzS01AwiwCqhLTPr4Ca+UFOu5w6xk2CFtQ4uTMJ2BxZgF1iT/zLjFD2NoSyxa+Zp7AKDgL SdksJGWzkJQtYGRexSibklulm5uYmVOcmqxbnJyYl5dapGuhl5tZopeaUrqJERS87C6qOxgn HFI6xCjAwajEw2vx9UyAEGtiWXFl7iFGSQ4mJVHeea/PBgjxJeWnVGYkFmfEF5XmpBYfYpTg YFYS4f17DyjHm5JYWZValA+TkuZgURLnvZFy019IID2xJDU7NbUgtQgmK8PBoSTBe/MNUKNg UWp6akVaZk4JQpqJgxNkOA/Q8LsgNbzFBYm5xZnpEPlTjLocv/7deMooxJKXn5cqJc57BqRI AKQoozQPbg4s6bxiFAd6S5j3KUgVDzBhwU16BbSECWjJcpszIEtKEhFSUg2MZrITd1ot2Mgf 1xZ0oDl/N8eHs35Pm7/+fxlQJ6EUVvx/8W+Gjet/uigk/dn+MHP3g6yp+Xy3J0w98v9fy2Wj SOvKWvWvfAf9d7VP2+W9LEIkdLPfRG5hNut/F5Z1iVa9sZP/IOm0Q1Vmosc2xcvGlcpW7nsn ptx8FNa6ZybX6Quvv0mK/LKXUGIpzkg01GIuKk4EAA/RdyUVAwAA 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: Sun, 16 Dec 2012 15:51:14 -0000 On Sun, 09 Dec 2012, Jani Nikula wrote: > --- > test/text | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/test/text b/test/text > index 428c89b..e003a66 100755 > --- a/test/text > +++ b/test/text > @@ -52,4 +52,33 @@ output=3D$(notmuch search --format=3Dtext "t=C3=ABxt-s= earch-m=C3=A9ssage" | notmuch_search_s > test_expect_equal "$output" \ > "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; text-search-utf8-body= -s=C3=BCbj=C3=A9ct (inbox unread)" >=20=20 > +add_email_corpus > + > +test_begin_subtest "Search message tags: text0" > +cat < EXPECTED.$test_count Other tests use just OUTPUT and EXPECTED. Why the $test_count? Is there a technical reason for it? > +attachment inbox signed unread > +EOF > +notmuch search --format=3Dtext0 --output=3Dtags '*' | xargs -0 | notmuch= _search_sanitize > OUTPUT.$test_count > +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count > + > +test_begin_subtest "Compare text vs. text0 for threads" > +notmuch search --format=3Dtext --output=3Dthreads '*' | notmuch_search_s= anitize > EXPECTED.$test_count > +notmuch search --format=3Dtext0 --output=3Dthreads '*' | xargs -0 -L1 | = notmuch_search_sanitize > OUTPUT.$test_count I think it would be worth "strengthening" these tests as Mark pointed out. It would be easy to accidentally include a literal \n in the output instead of calling the separator method, and this test wouldn't catch that. I think Mark's suggestion with tr is pretty good, since it directly disambiguates \0 and \n in the output, while producing a reasonable diff if things do go wrong. > +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count > + > +test_begin_subtest "Compare text vs. text0 for messages" > +notmuch search --format=3Dtext --output=3Dmessages '*' | notmuch_search_= sanitize > EXPECTED.$test_count > +notmuch search --format=3Dtext0 --output=3Dmessages '*' | xargs -0 -L1 |= notmuch_search_sanitize > OUTPUT.$test_count > +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count > + > +test_begin_subtest "Compare text vs. text0 for files" > +notmuch search --format=3Dtext --output=3Dfiles '*' | notmuch_search_san= itize > EXPECTED.$test_count > +notmuch search --format=3Dtext0 --output=3Dfiles '*' | xargs -0 -L1 | no= tmuch_search_sanitize > OUTPUT.$test_count > +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count > + > +test_begin_subtest "Compare text vs. text0 for tags" > +notmuch search --format=3Dtext --output=3Dtags '*' | notmuch_search_sani= tize > EXPECTED.$test_count > +notmuch search --format=3Dtext0 --output=3Dtags '*' | xargs -0 -L1 | not= much_search_sanitize > OUTPUT.$test_count > +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count > + > test_done > --=20 > 1.7.10.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch