[PATCH 10/10] tests: bsd sed doesn't allow replacing '\n'
authorMike Kelly <pioto@pioto.org>
Fri, 25 May 2012 13:43:31 +0000 (09:43 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:23 +0000 (09:47 -0800)
3e/2198f47d70312f6b947870fb56ebea5532d627 [new file with mode: 0644]

diff --git a/3e/2198f47d70312f6b947870fb56ebea5532d627 b/3e/2198f47d70312f6b947870fb56ebea5532d627
new file mode 100644 (file)
index 0000000..579ef45
--- /dev/null
@@ -0,0 +1,205 @@
+Return-Path: <pioto@pioto.org>\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 4942D431FBC\r
+       for <notmuch@notmuchmail.org>; Fri, 25 May 2012 06:44:19 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 DqOD5vte6Pgs for <notmuch@notmuchmail.org>;\r
+       Fri, 25 May 2012 06:44:18 -0700 (PDT)\r
+Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com\r
+       [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 35978431FAF\r
+       for <notmuch@notmuchmail.org>; Fri, 25 May 2012 06:44:18 -0700 (PDT)\r
+Received: by mail-vb0-f53.google.com with SMTP id fc26so989685vbb.26\r
+       for <notmuch@notmuchmail.org>; Fri, 25 May 2012 06:44:18 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :x-gm-message-state;\r
+       bh=v6ZvlLsSyWlllxd7IlGktd5rlwFC5HF8OVuM+a9ROJ8=;\r
+       b=NvFHh2LwFayYspxgezHq+67Foa1MIMrtIGy/gqFDL/4BpCPLf7foLXSYq6Lz/F1/Kp\r
+       jGmG1cxssBuzBGlwK1ewwYnkrRHTgHRnNbgatQXGqw/DGb7j5GnULChhXn6jwRQC+Mb8\r
+       Zy2ibEcaX4Ha4JzvgiOJhyAwSfP9Ew0iol4fxDwiyrnzWMsFy4WG6E1irAtYWg3bnbS6\r
+       GNEAI8+WlrRTqEBl/ZxEEQvDiB4T9g3tGzvX5HWsuCoWUxeSmtj6DTliE4YHz78iPi6O\r
+       qL7N1nvZr4jcOmE54Tg5OcnH4fRl5+HO9W93gWzpE9FDaT1w6NLUe2/DUZ1LJH+ChPGb\r
+       +O4Q==\r
+Received: by 10.52.24.179 with SMTP id v19mr3111228vdf.127.1337953458008;\r
+       Fri, 25 May 2012 06:44:18 -0700 (PDT)\r
+Received: from nas.home.pioto.org (pool-71-182-155-97.pitbpa.fios.verizon.net.\r
+       [71.182.155.97])\r
+       by mx.google.com with ESMTPS id by2sm4223643vdb.22.2012.05.25.06.44.17\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 25 May 2012 06:44:17 -0700 (PDT)\r
+Received: by nas.home.pioto.org (Postfix, from userid 1001)\r
+       id CB2B6287D2; Fri, 25 May 2012 09:44:16 -0400 (EDT)\r
+From: Mike Kelly <pioto@pioto.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 10/10]  tests: bsd sed doesn't allow replacing '\n'\r
+Date: Fri, 25 May 2012 09:43:31 -0400\r
+Message-Id: <1337953411-21000-11-git-send-email-pioto@pioto.org>\r
+X-Mailer: git-send-email 1.7.10.2\r
+In-Reply-To: <1337953411-21000-1-git-send-email-pioto@pioto.org>\r
+References: <1337953411-21000-1-git-send-email-pioto@pioto.org>\r
+X-Gm-Message-State:\r
+ ALoCoQlOjw3LAPwNN/rPzY16hBMTw+2UWq2Y0NzmQsMvUd4QZRIhf099vLqEkHfqBS8n+6K60fll\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: Fri, 25 May 2012 13:44:19 -0000\r
+\r
+Various workarounds still don't act quite the same way. So, just use\r
+perl, which seems to act the way these tests expect.\r
+---\r
+ test/maildir-sync |    2 +-\r
+ test/multipart    |   22 +++++++++++-----------\r
+ test/test-lib.sh  |    2 +-\r
+ 3 files changed, 13 insertions(+), 13 deletions(-)\r
+\r
+diff --git a/test/maildir-sync b/test/maildir-sync\r
+index d72ec07..311ea44 100755\r
+--- a/test/maildir-sync\r
++++ b/test/maildir-sync\r
+@@ -8,7 +8,7 @@ test_description="maildir synchronization"\r
+ # --format=json" output includes some newlines. Also, need to avoid\r
+ # including the local value of MAIL_DIR in the result.\r
+ filter_show_json() {\r
+-    sed -e 's/, /,\n/g'  | sed -e "s|${MAIL_DIR}/|MAIL_DIR/|"\r
++    perl -npe 's/, /,\n/g' | sed -e "s|${MAIL_DIR}/|MAIL_DIR/|"\r
+     echo\r
+ }\r
+ \r
+diff --git a/test/multipart b/test/multipart\r
+index 72d3927..c868b7b 100755\r
+--- a/test/multipart\r
++++ b/test/multipart\r
+@@ -319,7 +319,7 @@ test_expect_success \\r
+     "notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"\r
+ \r
+ test_begin_subtest "--format=json --part=0, full message"\r
+-notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -337,7 +337,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=1, message body"\r
+-notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -354,7 +354,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=2, multipart/mixed"\r
+-notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -369,7 +369,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=3, rfc822 part"\r
+-notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -381,7 +381,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=4, rfc822's multipart/alternative"\r
+-notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -392,7 +392,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=5, rfc822's html part"\r
+-notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -401,7 +401,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=6, rfc822's text part"\r
+-notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -410,7 +410,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=7, inline attachment"\r
+-notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -419,7 +419,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=8, plain text part"\r
+-notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -428,7 +428,7 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "--format=json --part=9, pgp signature (unverified)"\r
+-notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT\r
++notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' | perl -npe 's|{"id":|\n{"id":|g' >OUTPUT\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+@@ -669,4 +669,4 @@ notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out\r
+ echo -n -e "\xEF\x0D\x0A" > crlf.expected\r
+ test_expect_equal_file crlf.out crlf.expected\r
+ \r
+-test_done\r
+\ No newline at end of file\r
++test_done\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 06aaea2..4990ad6 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -565,7 +565,7 @@ notmuch_show_sanitize_all ()\r
+ \r
+ notmuch_json_show_sanitize ()\r
+ {\r
+-    sed -e 's|, |,\n |g' | \\r
++    perl -npe 's|, |,\n |g' | \\r
+       sed \\r
+       -e 's|"id": "[^"]*",|"id": "XXXXX",|' \\r
+       -e 's|"filename": "[^"]*",|"filename": "YYYYY",|'\r
+-- \r
+1.7.10.2\r
+\r