X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Fsearch-output;h=5ccfeaf914847966b3a2b92b1627d7769a460f09;hp=8ba8acf741af29172e97c12a2cac2caa8a54d640;hb=820a88eaaaf2edb01cef1f08eb55047ecea6c963;hpb=7a453716c27f09063e0bda56b9ba1d6b2cdd17b5 diff --git a/test/search-output b/test/search-output index 8ba8acf7..5ccfeaf9 100755 --- a/test/search-output +++ b/test/search-output @@ -4,7 +4,7 @@ test_description='various settings for "notmuch search --output="' add_email_corpus -test_begin_subtest "notmuch search --output=threads" +test_begin_subtest "--output=threads" notmuch search --output=threads '*' | sed -e s/thread:.*/thread:THREADID/ >OUTPUT cat <EXPECTED thread:THREADID @@ -29,10 +29,12 @@ thread:THREADID thread:THREADID thread:THREADID thread:THREADID +thread:THREADID +thread:THREADID EOF test_expect_equal_file OUTPUT EXPECTED -test_begin_subtest "notmuch search --format=json --output=threads" +test_begin_subtest "--output=threads --format=json" notmuch search --format=json --output=threads '*' | sed -e s/\".*\"/\"THREADID\"/ >OUTPUT cat <EXPECTED ["THREADID", @@ -56,13 +58,17 @@ cat <EXPECTED "THREADID", "THREADID", "THREADID", +"THREADID", +"THREADID", "THREADID"] EOF -test_expect_equal_file OUTPUT EXPECTED +test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" -test_begin_subtest "notmuch search --output=messages" +test_begin_subtest "--output=messages" notmuch search --output=messages '*' >OUTPUT cat <EXPECTED +id:4EFC743A.3060609@april.org +id:877h1wv7mg.fsf@inf-8657.int-evry.fr id:1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk id:877htoqdbo.fsf@yoom.home.cworth.org id:878we4qdqf.fsf@yoom.home.cworth.org @@ -116,10 +122,12 @@ id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net EOF test_expect_equal_file OUTPUT EXPECTED -test_begin_subtest "notmuch search --format=json --output=messages" +test_begin_subtest "--output=messages --format=json" notmuch search --format=json --output=messages '*' >OUTPUT cat <EXPECTED -["1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk", +["4EFC743A.3060609@april.org", +"877h1wv7mg.fsf@inf-8657.int-evry.fr", +"1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk", "877htoqdbo.fsf@yoom.home.cworth.org", "878we4qdqf.fsf@yoom.home.cworth.org", "87aaykqe24.fsf@yoom.home.cworth.org", @@ -172,9 +180,11 @@ cat <EXPECTED EOF test_expect_equal_file OUTPUT EXPECTED -test_begin_subtest "notmuch search --output=files" +test_begin_subtest "--output=files" notmuch search --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT cat <EXPECTED +MAIL_DIR/cur/52:2, +MAIL_DIR/cur/53:2, MAIL_DIR/cur/50:2, MAIL_DIR/cur/49:2, MAIL_DIR/cur/48:2, @@ -207,6 +217,7 @@ MAIL_DIR/cur/22:2, MAIL_DIR/cur/21:2, MAIL_DIR/cur/19:2, MAIL_DIR/cur/18:2, +MAIL_DIR/cur/51:2, MAIL_DIR/cur/20:2, MAIL_DIR/cur/17:2, MAIL_DIR/cur/16:2, @@ -228,10 +239,70 @@ MAIL_DIR/cur/01:2, EOF test_expect_equal_file OUTPUT EXPECTED -test_begin_subtest "notmuch search --format=json --output=files" +test_begin_subtest "--output=files --duplicate=1" +notmuch search --output=files --duplicate=1 '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT +cat <EXPECTED +MAIL_DIR/cur/52:2, +MAIL_DIR/cur/53:2, +MAIL_DIR/cur/50:2, +MAIL_DIR/cur/49:2, +MAIL_DIR/cur/48:2, +MAIL_DIR/cur/47:2, +MAIL_DIR/cur/46:2, +MAIL_DIR/cur/45:2, +MAIL_DIR/cur/44:2, +MAIL_DIR/cur/43:2, +MAIL_DIR/cur/42:2, +MAIL_DIR/cur/41:2, +MAIL_DIR/cur/40:2, +MAIL_DIR/cur/39:2, +MAIL_DIR/cur/38:2, +MAIL_DIR/cur/37:2, +MAIL_DIR/cur/36:2, +MAIL_DIR/cur/35:2, +MAIL_DIR/cur/34:2, +MAIL_DIR/cur/33:2, +MAIL_DIR/cur/32:2, +MAIL_DIR/cur/31:2, +MAIL_DIR/cur/30:2, +MAIL_DIR/cur/29:2, +MAIL_DIR/cur/28:2, +MAIL_DIR/cur/27:2, +MAIL_DIR/cur/26:2, +MAIL_DIR/cur/25:2, +MAIL_DIR/cur/24:2, +MAIL_DIR/cur/23:2, +MAIL_DIR/cur/22:2, +MAIL_DIR/cur/21:2, +MAIL_DIR/cur/19:2, +MAIL_DIR/cur/18:2, +MAIL_DIR/cur/20:2, +MAIL_DIR/cur/17:2, +MAIL_DIR/cur/16:2, +MAIL_DIR/cur/15:2, +MAIL_DIR/cur/14:2, +MAIL_DIR/cur/13:2, +MAIL_DIR/cur/12:2, +MAIL_DIR/cur/11:2, +MAIL_DIR/cur/10:2, +MAIL_DIR/cur/09:2, +MAIL_DIR/cur/08:2, +MAIL_DIR/cur/06:2, +MAIL_DIR/cur/05:2, +MAIL_DIR/cur/04:2, +MAIL_DIR/cur/03:2, +MAIL_DIR/cur/07:2, +MAIL_DIR/cur/02:2, +MAIL_DIR/cur/01:2, +EOF +test_expect_equal_file OUTPUT EXPECTED + +test_begin_subtest "--output=files --format=json" notmuch search --format=json --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT cat <EXPECTED -["MAIL_DIR/cur/50:2,", +["MAIL_DIR/cur/52:2,", +"MAIL_DIR/cur/53:2,", +"MAIL_DIR/cur/50:2,", "MAIL_DIR/cur/49:2,", "MAIL_DIR/cur/48:2,", "MAIL_DIR/cur/47:2,", @@ -263,6 +334,7 @@ cat <EXPECTED "MAIL_DIR/cur/21:2,", "MAIL_DIR/cur/19:2,", "MAIL_DIR/cur/18:2,", +"MAIL_DIR/cur/51:2,", "MAIL_DIR/cur/20:2,", "MAIL_DIR/cur/17:2,", "MAIL_DIR/cur/16:2,", @@ -284,7 +356,14 @@ cat <EXPECTED EOF test_expect_equal_file OUTPUT EXPECTED -test_begin_subtest "notmuch search --output=tags" +test_begin_subtest "--output=files --format=json --duplicate=2" +notmuch search --format=json --output=files --duplicate=2 '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT +cat <EXPECTED +["MAIL_DIR/cur/51:2,"] +EOF +test_expect_equal_file OUTPUT EXPECTED + +test_begin_subtest "--output=tags" notmuch search --output=tags '*' >OUTPUT cat <EXPECTED attachment @@ -294,7 +373,7 @@ unread EOF test_expect_equal_file OUTPUT EXPECTED -test_begin_subtest "notmuch search --format=json --output=tags" +test_begin_subtest "--output=tags --format=json" notmuch search --format=json --output=tags '*' >OUTPUT cat <EXPECTED ["attachment", @@ -304,16 +383,23 @@ cat <EXPECTED EOF test_expect_equal_file OUTPUT EXPECTED -test_begin_subtest "notmuch search for non-existent message prints nothing" +test_begin_subtest "sanitize output for quoted-printable line-breaks in author and subject" +add_message "[subject]='two =?ISO-8859-1?Q?line=0A_subject?= + headers'" +notmuch search id:"$gen_msg_id" | notmuch_search_sanitize >OUTPUT +cat <EXPECTED +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; two line? subject headers (inbox unread) +EOF +test_expect_equal_file OUTPUT EXPECTED + +test_begin_subtest "search for non-existent message prints nothing" notmuch search "no-message-matches-this" > OUTPUT echo -n >EXPECTED test_expect_equal_file OUTPUT EXPECTED -test_begin_subtest "notmuch search --format=json for non-existent message prints proper empty json" +test_begin_subtest "search --format=json for non-existent message prints proper empty json" notmuch search --format=json "no-message-matches-this" > OUTPUT -cat <EXPECTED -[] -EOF +echo "[]" >EXPECTED test_expect_equal_file OUTPUT EXPECTED test_done