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