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 0FB08431FB6 for ; Tue, 4 Dec 2012 11:25:03 -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 NrXC4SPhp556 for ; Tue, 4 Dec 2012 11:24:59 -0800 (PST) Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU [18.7.68.36]) by olra.theworths.org (Postfix) with ESMTP id 2D350431FAE for ; Tue, 4 Dec 2012 11:24:59 -0800 (PST) X-AuditID: 12074424-b7fe06d0000008f0-68-50be4e0983da Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id D7.E2.02288.90E4EB05; Tue, 4 Dec 2012 14:24:57 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id qB4JOvqS011845; Tue, 4 Dec 2012 14:24:57 -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 qB4JOtct010089 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 4 Dec 2012 14:24:56 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1Tfy6x-0001ow-2h; Tue, 04 Dec 2012 14:24:55 -0500 From: Austin Clements To: Peter Feigl , notmuch@notmuchmail.org Subject: Re: [PATCH v2 4/5] Adding tests for --format=sexp. In-Reply-To: <1354632382-15609-5-git-send-email-craven@gmx.net> References: <1354632382-15609-1-git-send-email-craven@gmx.net> <1354632382-15609-5-git-send-email-craven@gmx.net> User-Agent: Notmuch/0.14+100~gcb9b0b0 (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Tue, 04 Dec 2012 14:24:54 -0500 Message-ID: <87a9tty60p.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+NgFvrGIsWRmVeSWpSXmKPExsUixG6nosvpty/A4Mc0EYu9De2MFtdvzmR2 YPJYvGk/m8ezVbeYA5iiuGxSUnMyy1KL9O0SuDIOHt3PWjDZvOLC5FvsDYz9Bl2MnBwSAiYS ez7vZYWwxSQu3FvP1sXIxSEksI9R4vbKTmYIZz2jxN9Zc9lAqoQELjBJzN8ZCGEvYZS43qIM YrMJ6EusWDsJbJKIgKXE1C+XgOo5OIQFrCXuL4gBCXMK2EtcnHSOGaK1UGLivR4WkBJRgXiJ y0sVQMIsAqoSk66sYQKxeYFu+3aigxnCFpQ4OfMJC4jNLKAu8WfeJWYIW1ti2cLXzBMYBWch KZuFpGwWkrIFjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdM31cjNL9FJTSjcxgoPXRWUHY/Mh pUOMAhyMSjy8Esb7AoRYE8uKK3MPMUpyMCmJ8v7zBArxJeWnVGYkFmfEF5XmpBYfYpTgYFYS 4f1nB5TjTUmsrEotyodJSXOwKInzXk+56S8kkJ5YkpqdmlqQWgSTleHgUJLgne4D1ChYlJqe WpGWmVOCkGbi4AQZzgM0fC5IDW9xQWJucWY6RP4Uo6KUOG8DSEIAJJFRmgfXC0surxjFgV4R 5uUGqeIBJia47ldAg5mABr8Q2g0yuCQRISXVwLgo3a25StW3lZ+VqeYEb1tKZq1Y6QSLiseK QdssnnfM5bJT6GuavO7c8uft67Pzm2xmuTbKXFR81MDIrFy0dOPaOW84I+a9Prbk6wwD9TiG Jp4Lk9UDT7I+M3fr4r8TfERykaDKi4DV+3//Uu+f+k9zguii4BLb+982vFOqydScFd9svn/j ciWW4oxEQy3mouJEAEdE04sJAwAA 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: Tue, 04 Dec 2012 19:25:03 -0000 It would be nice to use something like test_expect_equal_json for this (probably based on Emacs' pp function), but this is fine for now. On Tue, 04 Dec 2012, Peter Feigl wrote: > Add basic tests, the same as for json, for the S-Expression output > format. > --- > test/notmuch-test | 1 + > test/sexp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 49 insertions(+) > create mode 100755 test/sexp > > diff --git a/test/notmuch-test b/test/notmuch-test > index a6ef34f..ca9c3dc 100755 > --- a/test/notmuch-test > +++ b/test/notmuch-test > @@ -31,6 +31,7 @@ TESTS=3D" > excludes > tagging > json > + sexp > text > multipart > thread-naming > diff --git a/test/sexp b/test/sexp > new file mode 100755 > index 0000000..fdc9de6 > --- /dev/null > +++ b/test/sexp > @@ -0,0 +1,48 @@ > +#!/usr/bin/env bash > +test_description=3D"--format=3Dsexp output" > +. ./test-lib.sh > + > +test_begin_subtest "Show message: sexp" > +add_message "[subject]=3D\"sexp-show-subject\"" "[date]=3D\"Sat, 01 Jan = 2000 12:00:00 -0000\"" "[bcc]=3D\"test_suite+bcc@notmuchmail.org\"" "[reply= -to]=3D\"test_suite+replyto@notmuchmail.org\"" "[body]=3D\"sexp-show-messag= e\"" > +output=3D$(notmuch show --format=3Dsexp "sexp-show-message") > +test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (ma= tch t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail= /msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"i= nbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmu= ch Test Suite \") (To \"Notmuch Test Suite \") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply= -To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:= 00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \"sexp-= show-message\n\"))))) ())))" > + > +# This should be the same output as above. > +test_begin_subtest "Show message: sexp --body=3Dtrue" > +output=3D$(notmuch show --format=3Dsexp --body=3Dtrue "sexp-show-message= ") > +test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (ma= tch t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail= /msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"i= nbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmu= ch Test Suite \") (To \"Notmuch Test Suite \") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply= -To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:= 00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \"sexp-= show-message\n\"))))) ())))" > + > +test_begin_subtest "Show message: sexp --body=3Dfalse" > +output=3D$(notmuch show --format=3Dsexp --body=3Dfalse "sexp-show-messag= e") > +test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (ma= tch t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail= /msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"i= nbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmu= ch Test Suite \") (To \"Notmuch Test Suite \") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply= -To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:= 00 +0000\")))) ())))" > + > +test_begin_subtest "Search message: sexp" > +add_message "[subject]=3D\"sexp-search-subject\"" "[date]=3D\"Sat, 01 Ja= n 2000 12:00:00 -0000\"" "[body]=3D\"sexp-search-message\"" > +output=3D$(notmuch search --format=3Dsexp "sexp-search-message" | notmuc= h_search_sanitize) > +test_expect_equal "$output" "(((thread \"0000000000000002\") (timestamp = 946728000) (date_relative \"2000-01-01\") (matched 1) (total 1) (authors \"= Notmuch Test Suite\") (subject \"sexp-search-subject\") (tags (\"inbox\" \"= unread\"))))" > + > +test_begin_subtest "Show message: sexp, utf-8" > +add_message "[subject]=3D\"sexp-show-utf8-body-s=C3=BCbj=C3=A9ct\"" "[da= te]=3D\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=3D\"js=C3=B6n-show-m=C3= =A9ssage\"" > +output=3D$(notmuch show --format=3Dsexp "js=C3=B6n-show-m=C3=A9ssage") > +test_expect_equal "$output" "(((((id \"msg-003@notmuch-test-suite\") (ma= tch t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail= /msg-003\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"i= nbox\" \"unread\")) (headers ((Subject \"sexp-show-utf8-body-s=C3=BCbj=C3= =A9ct\") (From \"Notmuch Test Suite \") (To \"N= otmuch Test Suite \") (Date \"Sat, 01 Jan 2000 = 12:00:00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \= "js=C3=B6n-show-m=C3=A9ssage\n\"))))) ())))" > + > +test_begin_subtest "Show message: sexp, inline attachment filename" > +subject=3D'sexp-show-inline-attachment-filename' > +id=3D"sexp-show-inline-attachment-filename@notmuchmail.org" > +emacs_deliver_message \ > + "$subject" \ > + 'This is a test message with inline attachment with a filename' \ > + "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\") > + (message-goto-eoh) > + (insert \"Message-ID: <$id>\n\")" > +output=3D$(notmuch show --format=3Dsexp "id:$id") > +filename=3D$(notmuch search --output=3Dfiles "id:$id") > +test_expect_equal "$output" "(((((id \"sexp-show-inline-attachment-filen= ame@notmuchmail.org\") (match t) (excluded nil) (filename \"$filename\") (t= imestamp 946728000) (date_relative \"2000-01-01\") (tags (\"inbox\")) (head= ers ((Subject \"sexp-show-inline-attachment-filename\") (From \"Notmuch Tes= t Suite \") (To \"test_suite@notmuchmail.org\")= (Date \"Sat, 01 Jan 2000 12:00:00 +0000\"))) (body (((id 1) (content-type = \"multipart/mixed\") (content (((id 2) (content-type \"text/plain\") (conte= nt \"This is a test message with inline attachment with a filename\")) ((id= 3) (content-type \"application/octet-stream\") (filename \"README\")))))))= ) ())))" > + > +test_begin_subtest "Search message: sexp, utf-8" > +add_message "[subject]=3D\"sexp-search-utf8-body-s=C3=BCbj=C3=A9ct\"" "[= date]=3D\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=3D\"js=C3=B6n-search-m= =C3=A9ssage\"" > +output=3D$(notmuch search --format=3Dsexp "js=C3=B6n-search-m=C3=A9ssage= " | notmuch_search_sanitize) > +test_expect_equal "$output" "(((thread \"0000000000000005\") (timestamp = 946728000) (date_relative \"2000-01-01\") (matched 1) (total 1) (authors \"= Notmuch Test Suite\") (subject \"sexp-search-utf8-body-s=C3=BCbj=C3=A9ct\")= (tags (\"inbox\" \"unread\"))))" > + > + > +test_done > --=20 > 1.8.0 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch