[PATCH 2/2] test: fix order and format of test_expect_equal_file arguments
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Thu, 2 Feb 2012 00:04:10 +0000 (04:04 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:55 +0000 (09:43 -0800)
24/28e82eec58e6587d206323b1e25fe4796ff2a6 [new file with mode: 0644]

diff --git a/24/28e82eec58e6587d206323b1e25fe4796ff2a6 b/24/28e82eec58e6587d206323b1e25fe4796ff2a6
new file mode 100644 (file)
index 0000000..ba2b70a
--- /dev/null
@@ -0,0 +1,387 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8B26E431FAF\r
+       for <notmuch@notmuchmail.org>; Wed,  1 Feb 2012 16:05:36 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id Fv2aFVDq+UYw for <notmuch@notmuchmail.org>;\r
+       Wed,  1 Feb 2012 16:05:35 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E2937431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  1 Feb 2012 16:05:34 -0800 (PST)\r
+Received: by mail-bk0-f53.google.com with SMTP id 11so1737569bke.26\r
+       for <notmuch@notmuchmail.org>; Wed, 01 Feb 2012 16:05:34 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=vAMIyUQKhwcWoisgfuf+tZP/+34DTu4LLfQJJYW7kDs=;\r
+       b=gYblaVD3kLsxSPL+uxmTKj8qVCAWF48p0SEuUFsNeNgWjEe6SLDEXYfXcxJeNXG1EQ\r
+       YWQJUkRct70Q4GbM2/PxtMHOTYe0BlNpit/nF71o2Mu7zazAk4Rerkr5opvYAeii372e\r
+       4sTrhW329ZiTeMCkH6HyrX3NpiogK1nRkxEfU=\r
+Received: by 10.204.133.219 with SMTP id g27mr310284bkt.47.1328141130624;\r
+       Wed, 01 Feb 2012 16:05:30 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id ga13sm1587085bkc.5.2012.02.01.16.05.29\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 01 Feb 2012 16:05:30 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] test: fix order and format of test_expect_equal_file\r
+       arguments\r
+Date: Thu,  2 Feb 2012 04:04:10 +0400\r
+Message-Id: <1328141050-30356-3-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.9\r
+In-Reply-To: <1328141050-30356-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1328141050-30356-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 02 Feb 2012 00:05:36 -0000\r
+\r
+The patch fixes tests which were broken by the new\r
+test_expect_equal_file() argument check.  Some tests have correct\r
+filename format, but wrong argument order.  Others require files to be\r
+renamed.\r
+---\r
+ test/crypto          |   10 +++++-----\r
+ test/dump-restore    |   10 +++++-----\r
+ test/hooks           |    8 ++++----\r
+ test/multipart       |   20 ++++++++++----------\r
+ test/search-limiting |   22 +++++++++++-----------\r
+ test/symbol-hiding   |    4 ++--\r
+ 6 files changed, 37 insertions(+), 37 deletions(-)\r
+\r
+diff --git a/test/crypto b/test/crypto\r
+index 446a58b..9fdf710 100755\r
+--- a/test/crypto\r
++++ b/test/crypto\r
+@@ -140,14 +140,14 @@ test_expect_equal \\r
+ mv "${GNUPGHOME}"{.bak,}\r
\r
+ # create a test encrypted message with attachment\r
+-cat <<EOF >TESTATTACHMENT\r
++cat <<EOF >TESTATTACHMENT.expected\r
+ This is a test file.\r
+ EOF\r
+ test_expect_success 'emacs delivery of encrypted message with attachment' \\r
+ 'emacs_deliver_message \\r
+     "test encrypted message 001" \\r
+     "This is a test encrypted message.\n" \\r
+-    "(mml-attach-file \"TESTATTACHMENT\") (mml-secure-message-encrypt)"'\r
++    "(mml-attach-file \"TESTATTACHMENT.expected\") (mml-secure-message-encrypt)"'\r
\r
+ test_begin_subtest "decryption, --format=text"\r
+ output=$(notmuch show --format=text --decrypt subject:"test encrypted message 001" \\r
+@@ -170,7 +170,7 @@ Non-text part: application/pgp-encrypted\r
\f\r
+part{ ID: 4, Content-type: text/plain\r
+ This is a test encrypted message.\r
\f\r
+part}\r
+-\f\r
+attachment{ ID: 5, Filename: TESTATTACHMENT, Content-type: application/octet-stream\r
++\f\r
+attachment{ ID: 5, Filename: TESTATTACHMENT.expected, Content-type: application/octet-stream\r
+ Non-text part: application/octet-stream\r
\f\r
+attachment}\r
\f\r
+part}\r
+@@ -210,7 +210,7 @@ expected='[[[{"id": "XXXXX",\r
+  "content": "This is a test encrypted message.\n"},\r
+  {"id": 5,\r
+  "content-type": "application/octet-stream",\r
+- "filename": "TESTATTACHMENT"}]}]}]},\r
++ "filename": "TESTATTACHMENT.expected"}]}]}]},\r
+  []]]]'\r
+ test_expect_equal \\r
+     "$output" \\r
+@@ -233,7 +233,7 @@ notmuch show \\r
+     --part=5 \\r
+     --decrypt \\r
+     subject:"test encrypted message 001" >OUTPUT\r
+-test_expect_equal_file OUTPUT TESTATTACHMENT\r
++test_expect_equal_file OUTPUT TESTATTACHMENT.expected\r
\r
+ test_begin_subtest "decryption failure with missing key"\r
+ mv "${GNUPGHOME}"{,.bak}\r
+diff --git a/test/dump-restore b/test/dump-restore\r
+index 439e998..a6cfce2 100755\r
+--- a/test/dump-restore\r
++++ b/test/dump-restore\r
+@@ -55,7 +55,7 @@ test_expect_success 'Invalid restore invocation' \\r
\r
+ test_begin_subtest "dump outfile"\r
+ notmuch dump dump-outfile.actual\r
+-test_expect_equal_file dump.expected dump-outfile.actual\r
++test_expect_equal_file dump-outfile.actual dump.expected\r
\r
+ test_begin_subtest "dump outfile # deprecated"\r
+ test_expect_equal "Warning: the output file argument of dump is deprecated."\\r
+@@ -63,7 +63,7 @@ test_expect_equal "Warning: the output file argument of dump is deprecated."\\r
\r
+ test_begin_subtest "dump outfile --"\r
+ notmuch dump dump-1-arg-dash.actual --\r
+-test_expect_equal_file dump.expected dump-1-arg-dash.actual\r
++test_expect_equal_file dump-1-arg-dash.actual dump.expected\r
\r
+ # Note, we assume all messages from cworth have a message-id\r
+ # containing cworth.org\r
+@@ -72,14 +72,14 @@ grep 'cworth[.]org' dump.expected > dump-cworth.expected\r
\r
+ test_begin_subtest "dump -- from:cworth"\r
+ notmuch dump -- from:cworth > dump-dash-cworth.actual\r
+-test_expect_equal_file dump-cworth.expected dump-dash-cworth.actual\r
++test_expect_equal_file dump-dash-cworth.actual dump-cworth.expected\r
\r
+ test_begin_subtest "dump outfile from:cworth"\r
+ notmuch dump dump-outfile-cworth.actual from:cworth\r
+-test_expect_equal_file dump-cworth.expected dump-outfile-cworth.actual\r
++test_expect_equal_file dump-outfile-cworth.actual dump-cworth.expected\r
\r
+ test_begin_subtest "dump outfile -- from:cworth"\r
+ notmuch dump dump-outfile-dash-inbox.actual -- from:cworth\r
+-test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual\r
++test_expect_equal_file dump-outfile-dash-inbox.actual dump-cworth.expected\r
\r
+ test_done\r
+diff --git a/test/hooks b/test/hooks\r
+index 77e8569..d084d1f 100755\r
+--- a/test/hooks\r
++++ b/test/hooks\r
+@@ -36,14 +36,14 @@ rm_hooks\r
+ generate_message\r
+ create_echo_hook "pre-new" expected output\r
+ notmuch new > /dev/null\r
+-test_expect_equal_file expected output\r
++test_expect_equal_file output expected\r
\r
+ test_begin_subtest "post-new is run"\r
+ rm_hooks\r
+ generate_message\r
+ create_echo_hook "post-new" expected output\r
+ notmuch new > /dev/null\r
+-test_expect_equal_file expected output\r
++test_expect_equal_file output expected\r
\r
+ test_begin_subtest "pre-new is run before post-new"\r
+ rm_hooks\r
+@@ -51,7 +51,7 @@ generate_message\r
+ create_echo_hook "pre-new" pre-new.expected pre-new.output\r
+ create_echo_hook "post-new" post-new.expected post-new.output\r
+ notmuch new > /dev/null\r
+-test_expect_equal_file post-new.expected post-new.output\r
++test_expect_equal_file post-new.output post-new.expected\r
\r
+ test_begin_subtest "pre-new non-zero exit status (hook status)"\r
+ rm_hooks\r
+@@ -77,7 +77,7 @@ NOTMUCH_NEW 2>output.stderr >output\r
+ cat output.stderr >> output\r
+ echo "Added 1 new message to the database." > expected\r
+ echo "Error: post-new hook failed with status 13" >> expected\r
+-test_expect_equal_file expected output\r
++test_expect_equal_file output expected\r
\r
+ # depends on the previous subtest leaving broken hook behind\r
+ test_expect_code 1 "post-new non-zero exit status (notmuch status)" "notmuch new"\r
+diff --git a/test/multipart b/test/multipart\r
+index 2dd73f5..c25cdf6 100755\r
+--- a/test/multipart\r
++++ b/test/multipart\r
+@@ -2,7 +2,7 @@\r
+ test_description="output of multipart message"\r
+ . ./test-lib.sh\r
\r
+-cat <<EOF > embedded_message\r
++cat <<EOF > embedded_message.expected\r
+ From: Carl Worth <cworth@cworth.org>\r
+ To: cworth@cworth.org\r
+ Subject: html message\r
+@@ -25,7 +25,7 @@ This is an embedded message, with a multipart/alternative part.\r
+ --==-=-==--\r
+ EOF\r
\r
+-cat <<EOF > ${MAIL_DIR}/multipart\r
++cat <<EOF > ${MAIL_DIR}/multipart.expected\r
+ From: Carl Worth <cworth@cworth.org>\r
+ To: cworth@cworth.org\r
+ Subject: Multipart message\r
+@@ -44,8 +44,8 @@ Content-Type: message/rfc822\r
+ Content-Disposition: inline\r
\r
+ EOF\r
+-cat embedded_message >> ${MAIL_DIR}/multipart\r
+-cat <<EOF >> ${MAIL_DIR}/multipart\r
++cat embedded_message.expected >> ${MAIL_DIR}/multipart.expected\r
++cat <<EOF >> ${MAIL_DIR}/multipart.expected\r
+ --=-=-=\r
+ Content-Disposition: attachment; filename=attachment\r
\r
+@@ -108,7 +108,7 @@ notmuch new > /dev/null\r
+ test_begin_subtest "--format=text --part=0, full message"\r
+ notmuch show --format=text --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
+ cat <<EOF >EXPECTED\r
+-\f\r
+message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart\r
++\f\r
+message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart.expected\r
\f\r
+header{\r
+ Carl Worth <cworth@cworth.org> (2001-01-05) (attachment inbox signed unread)\r
+ Subject: Multipart message\r
+@@ -322,7 +322,7 @@ notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | s\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
\r
+-{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [\r
++{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart.expected", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [\r
+ {"id": 1, "content-type": "multipart/signed", "content": [\r
+ {"id": 2, "content-type": "multipart/mixed", "content": [\r
+ {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [\r
+@@ -441,11 +441,11 @@ test_expect_success \\r
\r
+ test_begin_subtest "--format=raw"\r
+ notmuch show --format=raw 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
+-test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart\r
++test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart.expected\r
\r
+ test_begin_subtest "--format=raw --part=0, full message"\r
+ notmuch show --format=raw --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
+-test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart\r
++test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart.expected\r
\r
+ test_begin_subtest "--format=raw --part=1, message body"\r
+ notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
+@@ -494,7 +494,7 @@ test_begin_subtest "--format=raw --part=3, rfc822 part"\r
+ test_subtest_known_broken\r
\r
+ notmuch show --format=raw --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
+-test_expect_equal_file OUTPUT embedded_message\r
++test_expect_equal_file OUTPUT embedded_message.expected\r
\r
+ test_begin_subtest "--format=raw --part=4, rfc822's html part"\r
+ notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
+@@ -556,7 +556,7 @@ test_expect_success \\r
+ test_begin_subtest "--format=mbox"\r
+ notmuch show --format=mbox 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT\r
+ printf "From cworth@cworth.org Fri Jan  5 15:43:57 2001\n" >EXPECTED\r
+-cat "${MAIL_DIR}"/multipart >>EXPECTED\r
++cat "${MAIL_DIR}"/multipart.expected >>EXPECTED\r
+ # mbox output is expected to include a blank line\r
+ echo >>EXPECTED\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+diff --git a/test/search-limiting b/test/search-limiting\r
+index 303762c..e93c76a 100755\r
+--- a/test/search-limiting\r
++++ b/test/search-limiting\r
+@@ -8,19 +8,19 @@ for outp in messages threads; do\r
+     test_begin_subtest "${outp}: limit does the right thing"\r
+     notmuch search --output=${outp} "*" | head -n 20 >expected\r
+     notmuch search --output=${outp} --limit=20 "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: concatenation of limited searches"\r
+     notmuch search --output=${outp} "*" | head -n 20 >expected\r
+     notmuch search --output=${outp} --limit=10 "*" >output\r
+     notmuch search --output=${outp} --limit=10 --offset=10 "*" >>output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: limit larger than result set"\r
+     N=`notmuch count --output=${outp} "*"`\r
+     notmuch search --output=${outp} "*" >expected\r
+     notmuch search --output=${outp} --limit=$((1 + ${N})) "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: limit = 0"\r
+     test_expect_equal "`notmuch search --output=${outp} --limit=0 "*"`" ""\r
+@@ -29,43 +29,43 @@ for outp in messages threads; do\r
+     # note: tail -n +N is 1-based\r
+     notmuch search --output=${outp} "*" | tail -n +21 >expected\r
+     notmuch search --output=${outp} --offset=20 "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: offset = 0"\r
+     notmuch search --output=${outp} "*" >expected\r
+     notmuch search --output=${outp} --offset=0 "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: negative offset"\r
+     notmuch search --output=${outp} "*" | tail -n 20 >expected\r
+     notmuch search --output=${outp} --offset=-20 "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: negative offset"\r
+     notmuch search --output=${outp} "*" | tail -n 1 >expected\r
+     notmuch search --output=${outp} --offset=-1 "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: negative offset combined with limit"\r
+     notmuch search --output=${outp} "*" | tail -n 20 | head -n 10 >expected\r
+     notmuch search --output=${outp} --offset=-20 --limit=10 "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: negative offset combined with equal limit"\r
+     notmuch search --output=${outp} "*" | tail -n 20 >expected\r
+     notmuch search --output=${outp} --offset=-20 --limit=20 "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: negative offset combined with large limit"\r
+     notmuch search --output=${outp} "*" | tail -n 20 >expected\r
+     notmuch search --output=${outp} --offset=-20 --limit=50 "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
\r
+     test_begin_subtest "${outp}: negative offset larger then results"\r
+     N=`notmuch count --output=${outp} "*"`\r
+     notmuch search --output=${outp} "*" >expected\r
+     notmuch search --output=${outp} --offset=-$((1 + ${N})) "*" >output\r
+-    test_expect_equal_file expected output\r
++    test_expect_equal_file output expected\r
+ done\r
\r
+ test_done\r
+diff --git a/test/symbol-hiding b/test/symbol-hiding\r
+index 636ec91..e6d896c 100755\r
+--- a/test/symbol-hiding\r
++++ b/test/symbol-hiding\r
+@@ -27,7 +27,7 @@ test_expect_equal "$result" "$output"\r
\r
+ test_begin_subtest 'comparing existing to exported symbols'\r
+ objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" {print $6}' | sort | uniq > ACTUAL\r
+-sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPORTED\r
+-test_expect_equal_file EXPORTED ACTUAL\r
++sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPECTED\r
++test_expect_equal_file ACTUAL EXPECTED\r
\r
+ test_done\r
+-- \r
+1.7.9\r
+\r