From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 15AD71F852 for ; Wed, 2 Feb 2022 04:20:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244527AbiBBEUV (ORCPT ); Tue, 1 Feb 2022 23:20:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244509AbiBBEUT (ORCPT ); Tue, 1 Feb 2022 23:20:19 -0500 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACEB7C061714 for ; Tue, 1 Feb 2022 20:20:19 -0800 (PST) Received: by mail-qt1-x830.google.com with SMTP id r14so16376336qtt.5 for ; Tue, 01 Feb 2022 20:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skydio.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bt/GF3MsdeipqIkIf556XVst83kCip4A8Wk9y3XFqJY=; b=yFgMWIwFkmW0OjPnD1VqMZDo38n10SntLK8yVPX/y/otmIIeLqDLKwnCB8n1HFLIfS 4buF6GDMbfSHN3ZTov67fEjKa6r5FeUr4mHVIO0AUhcsatpzrcel9vp8vNxxjHotkxUP Vqxyskoqp2T2Q37mvp58S95T175MSsZNDYZYCXsZaYFmEmtGxlP3w64MIXDIsEuGSbaF clM5mBkzCHKMy6qShq6b1iA1XUDTTCtlfC0ploOWaCEDMEBjJFnPM/pDWMVfaMqoTOwj gzFvKLwu7qqbHz3QGfftqyI+xvT3sgWVh3CHFHgfGVh8tnhihvKcTOdaYuIxUmKUthUX TN5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bt/GF3MsdeipqIkIf556XVst83kCip4A8Wk9y3XFqJY=; b=idTNaLok6sqY4s3p2IAppQCD9ProC7n0fHdTPtmvPLtReWJlggYrvNUbHkLRmhfvq2 BfWWR1PhneutEfiy3ErqGNY5m37QXz5R06QdU7mRdTirYhXIoGYfSKpr5FYGIll5LHkO QwPTGKdVjdjUjlhZLJyeLDC0UGLRi6iq1CojDp8RTE+ifz/A1/Eh+LCutsdAGbz2tiUe 1fOWn33qQYt0/Ypv8ssXuxnGfXKog4sKYUvNyTnxcq3BxiaN1d6lKVJm/p2/eptOks1H uZ+ReDOWvwq2HF0ixq0nZBwV3AH8EaADemzrFk7GSi0ohuz14M4iVFcsuA3EfYZgGg18 zhrg== X-Gm-Message-State: AOAM531rWT0w86OVUfrQ+bb+aGapFwt77aYfIajJ1ATbM0D9zJ745G/P hKnmjkt1szU6HmSqpLd0oR7Hfc9MycfzNw== X-Google-Smtp-Source: ABdhPJy+vjFyJ1Xl6E/DoHhNae4/zUSvZ6D9UQ2s9IVLQkEHykQM0BAq1cUiaUMsSr+YLF9E3ccg/Q== X-Received: by 2002:a05:622a:349:: with SMTP id r9mr21600672qtw.275.1643775618587; Tue, 01 Feb 2022 20:20:18 -0800 (PST) Received: from jerry-desktop2.localdomain ([50.236.240.214]) by smtp.gmail.com with ESMTPSA id m130sm11087502qke.55.2022.02.01.20.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 20:20:18 -0800 (PST) From: Jerry Zhang To: git@vger.kernel.org, gitster@pobox.com Cc: Jerry Zhang Subject: [PATCH V4 1/2] patch-id: Fix antipatterns in tests Date: Tue, 1 Feb 2022 20:20:15 -0800 Message-Id: <20220202042015.10115-1-jerry@skydio.com> X-Mailer: git-send-email 2.35.1.7.ge3b4973ce7 In-Reply-To: <20220131235218.27392-1-jerry@skydio.com> References: <20220131235218.27392-1-jerry@skydio.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Clean up the tests for patch-id by moving file preparation tasks inside the test body and redirecting files directly into stdin instead of using 'cat'. Signed-off-by: Jerry Zhang --- V3->V4: - Quote the EOF marker correctly t/t4204-patch-id.sh | 64 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/t/t4204-patch-id.sh b/t/t4204-patch-id.sh index 80f4a65b28..2bc940a07e 100755 --- a/t/t4204-patch-id.sh +++ b/t/t4204-patch-id.sh @@ -164,42 +164,40 @@ test_expect_success 'patch-id respects config from subdir' ' cd subdir && test_patch_id irrelevant patchid.stable=true ) ' -cat >nonl <<\EOF -diff --git i/a w/a -index e69de29..2e65efe 100644 ---- i/a -+++ w/a -@@ -0,0 +1 @@ -+a -\ No newline at end of file -diff --git i/b w/b -index e69de29..6178079 100644 ---- i/b -+++ w/b -@@ -0,0 +1 @@ -+b -EOF - -cat >withnl <<\EOF -diff --git i/a w/a -index e69de29..7898192 100644 ---- i/a -+++ w/a -@@ -0,0 +1 @@ -+a -diff --git i/b w/b -index e69de29..6178079 100644 ---- i/b -+++ w/b -@@ -0,0 +1 @@ -+b -EOF - test_expect_success 'patch-id handles no-nl-at-eof markers' ' - cat nonl | calc_patch_id nonl && - cat withnl | calc_patch_id withnl && + cat >nonl <<-\EOF && + diff --git i/a w/a + index e69de29..2e65efe 100644 + --- i/a + +++ w/a + @@ -0,0 +1 @@ + +a + \ No newline at end of file + diff --git i/b w/b + index e69de29..6178079 100644 + --- i/b + +++ w/b + @@ -0,0 +1 @@ + +b + EOF + cat >withnl <<-\EOF && + diff --git i/a w/a + index e69de29..7898192 100644 + --- i/a + +++ w/a + @@ -0,0 +1 @@ + +a + diff --git i/b w/b + index e69de29..6178079 100644 + --- i/b + +++ w/b + @@ -0,0 +1 @@ + +b + EOF + calc_patch_id nonl