From patchwork Wed Feb 15 02:39:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuqi Liang X-Patchwork-Id: 13141239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D16AFC05027 for ; Wed, 15 Feb 2023 02:40:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232889AbjBOCkg (ORCPT ); Tue, 14 Feb 2023 21:40:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232750AbjBOCke (ORCPT ); Tue, 14 Feb 2023 21:40:34 -0500 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7027127D7F for ; Tue, 14 Feb 2023 18:40:33 -0800 (PST) Received: by mail-qt1-x835.google.com with SMTP id cr22so20468230qtb.10 for ; Tue, 14 Feb 2023 18:40:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LTsBbEhpUqXc+8sr5ARxshDRtlGNv7DUXMnqRIuVHNE=; b=oSJGtwzPMANYjDd9/vUFOrbcxfkRlDDBNEwg3+toR01eSscvN0QLudl/GfLL/Jm4yr 2ML2NVSdIeF/A+OH1XJbfNFqQcq1gkoNrA9W+DdFbKbio41h9cvRBZOrxyE+bdxG4Hp1 PYSUZT2/tQUP61ufWGoCwGCQoZQ6wBnBrE/0moVZnPt1o/XdLb1pY2WIVc2FiSBYMWWO b9Ni6/W6qrjnFY3B2gw3+WWbMC6vALleYrJ/S3kOb/MfmkG0YeKft9EbWaEiQP8mksoX nUy5E094KMku22m0sap/13MGrMHGN4IKzxEwssWoYdQ9sjqnmoN2slxIrrdBtpBGrMWv UPYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LTsBbEhpUqXc+8sr5ARxshDRtlGNv7DUXMnqRIuVHNE=; b=7/KXHr0xOyDiPo6riu2TfSDSM/1eBoTLeyx8LCXx74a1JrMzCFYPDHB/vEJQew7lTU REiW+7rafcQn2+FZ8XQVyW2jepCD9CHOEjdDjMAU52G68gFbQ25vsO4d7oPrQ7EAZNNz HXVTVVMfx6lGH9oUxbDg+LdU40Y3vyUqCHPtR7Ihd/7GNvi70qCnQ0iOb16W2R/uKW44 kx0fl9p2nArWfyPBvkm/X3WDRG5ku9ImsX38HL89rzX5r3q8vlWe6bcF4vKH/d5oXMhS +AQuSNJcKmTJCzuu3NlNYImWQCVc1QEOPoF8M2mx4MDiiqOjl3VQY2ahu0lQGDRrR/GL YKIw== X-Gm-Message-State: AO0yUKUzQc+z+pqmBS0oTLR09+LDDYNSE2cRkiiAyVFuwrZA+PAZytbd yDC40xLV6vm5c/O85nrSHtU3UmNJDz6q+A== X-Google-Smtp-Source: AK7set/2NPp9BWSo2L7LWE/qxVjWL/Gf+ay+/C0ATxScIA0RPQkU3bZezETvmcp4634g0DJ4WoTILQ== X-Received: by 2002:a05:622a:88:b0:3a8:efd:2ef0 with SMTP id o8-20020a05622a008800b003a80efd2ef0mr791456qtw.60.1676428832187; Tue, 14 Feb 2023 18:40:32 -0800 (PST) Received: from cheska.uwo-x-22.wireless.uwo.pri (eclipse-22.wireless.uwo.ca. [129.100.255.37]) by smtp.googlemail.com with ESMTPSA id e184-20020a3769c1000000b0073b69922cfesm1069734qkc.85.2023.02.14.18.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 18:40:21 -0800 (PST) From: Shuqi Liang To: git@vger.kernel.org Cc: Shuqi Liang Subject: [PATCH v6 1/3] t4113: modernize test script Date: Tue, 14 Feb 2023 21:39:51 -0500 Message-Id: <20230215023953.11880-2-cheskaqiqi@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230215023953.11880-1-cheskaqiqi@gmail.com> References: <20230209154417.10763-1-cheskaqiqi@gmail.com> <20230215023953.11880-1-cheskaqiqi@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Test scripts in file in this script are written in old style, where the test_expect_success command and test title are written on separate lines. Change the old style to modern style. Signed-off-by: Shuqi Liang --- t/t4113-apply-ending.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index 66fa51591e..41526ca805 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -24,14 +24,14 @@ echo 'a' >file echo 'b' >>file echo 'c' >>file -test_expect_success setup \ - 'git update-index --add file' - +test_expect_success setup ' + git update-index --add file +' # test -test_expect_success 'apply at the end' \ - 'test_must_fail git apply --index test-patch' - +test_expect_success 'apply at the end' ' + test_must_fail git apply --index test-patch +' cat >test-patch <<\EOF diff a/file b/file --- a/file @@ -47,7 +47,7 @@ b c' git update-index file -test_expect_success 'apply at the beginning' \ - 'test_must_fail git apply --index test-patch' - +test_expect_success 'apply at the beginning' ' + test_must_fail git apply --index test-patch +' test_done From patchwork Wed Feb 15 02:39:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuqi Liang X-Patchwork-Id: 13141240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB42FC61DA4 for ; Wed, 15 Feb 2023 02:40:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232517AbjBOCkq (ORCPT ); Tue, 14 Feb 2023 21:40:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbjBOCkp (ORCPT ); Tue, 14 Feb 2023 21:40:45 -0500 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F24E0234D0 for ; Tue, 14 Feb 2023 18:40:44 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id m12so20500919qth.4 for ; Tue, 14 Feb 2023 18:40:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DhNQlDKUjRXmK5rcweYMF5p62ggFuazYB7/5iE0iZ7Q=; b=mPGr6AaUXfimrkzkoromj0b54f/qxPu4WcBidVIaaimP2VNvx7eQWpBfImiylTO0mE j+H32XutCMRqwjCSDjB5FfV5hkNEq81N+tg4w9pyRIWEfR1sLzk3+Nr22FIBhYj+thSN zVhO+STcj11vZMCfj5juom9ue/H06uIlqHbbrSHbnm6haw1oCpxWYqgVGQV4EXMrSzmt BB9QxpebjMrKUWlw2+79VXeuObVd8l/8slLuYOHnzd3z1KPrpyGf5KyT7+w3HnnwXCcA GE+iMW7G6TPO0nVHa3uvnOgTmikN7ssHRfxZ5zoFmcI4g/otaPs1MmEB/ZcGDyXKklJD s66A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DhNQlDKUjRXmK5rcweYMF5p62ggFuazYB7/5iE0iZ7Q=; b=AsCBsZcB5ZXaCmmbgUWot5NZUUdrzUDjuRsxIg2iC6IEuVmf+bYruqbW4OCxA/I8PE E5qL+Wzeys1R4QR9WI7yB2wx/Z1Uuimg8q3lmczfl0wKk8uJYFc0HB1dXjyo9hV3/8Ul X9j4W1Quk1t7fgzXlOKRG/2TSmt0crJOfWJfFdyuDp15hteBpnsw+4Jifxr8xgVFe9ge UrSiesYYNKnMOnf+RdE8Z64YoNASehcAu8RtAIgyDkeCI8Mo55qplG8kvjzTieUZhC4A VDPxfw3Yis3QAlepMcFN/V9NXtC1+bk4KB5tjk2nG3ey1Vb30qi2dqsuEcNOgsVxzxl9 pi+Q== X-Gm-Message-State: AO0yUKV8ikKUC7P2R5r+NLC1ltjhOjknhPXdhbvP9qP7n37WRob5Loww VFka336jbZTIf4SecgMgt1gi4O1tQHpzvQ== X-Google-Smtp-Source: AK7set/Cryf6L1qX7td9t44E/YbNezUwnhc9KiPyUrRCnjbITztRD0205rpDblJhdc81T3KMPY285A== X-Received: by 2002:a05:622a:1207:b0:3b9:e0b2:9a49 with SMTP id y7-20020a05622a120700b003b9e0b29a49mr749385qtx.60.1676428843718; Tue, 14 Feb 2023 18:40:43 -0800 (PST) Received: from cheska.uwo-x-22.wireless.uwo.pri (eclipse-22.wireless.uwo.ca. [129.100.255.37]) by smtp.googlemail.com with ESMTPSA id e184-20020a3769c1000000b0073b69922cfesm1069734qkc.85.2023.02.14.18.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 18:40:41 -0800 (PST) From: Shuqi Liang To: git@vger.kernel.org Cc: Shuqi Liang Subject: [PATCH v6 2/3] t4113: indent with tab Date: Tue, 14 Feb 2023 21:39:52 -0500 Message-Id: <20230215023953.11880-3-cheskaqiqi@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230215023953.11880-1-cheskaqiqi@gmail.com> References: <20230209154417.10763-1-cheskaqiqi@gmail.com> <20230215023953.11880-1-cheskaqiqi@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As Documentation/CodingGuidelines says, the shell scripts are to use tabs for indentation, but this script uses 4-column indent with space. Fix it in use tabs for indentation. Signed-off-by: Shuqi Liang --- t/t4113-apply-ending.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index 41526ca805..a470c9ce7b 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -25,12 +25,12 @@ echo 'b' >>file echo 'c' >>file test_expect_success setup ' - git update-index --add file + git update-index --add file ' # test test_expect_success 'apply at the end' ' - test_must_fail git apply --index test-patch + test_must_fail git apply --index test-patch ' cat >test-patch <<\EOF diff a/file b/file From patchwork Wed Feb 15 02:39:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuqi Liang X-Patchwork-Id: 13141241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31258C61DA4 for ; Wed, 15 Feb 2023 02:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232972AbjBOCk4 (ORCPT ); Tue, 14 Feb 2023 21:40:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232124AbjBOCkv (ORCPT ); Tue, 14 Feb 2023 21:40:51 -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 C87ED28239 for ; Tue, 14 Feb 2023 18:40:50 -0800 (PST) Received: by mail-qt1-x830.google.com with SMTP id c2so20504293qtw.5 for ; Tue, 14 Feb 2023 18:40:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=35iftTChXhbYCh3E5Wk4+TdQiuf6+npXGgVuS6deYQI=; b=AWrn08OzcUkfPamIxPcSLm9SLa6Z/pHfNCcuzgQ9pCHBkyaei+SXdARyulklxaWVv6 XD3tjqgBBPz9/WhcGnFWW4feCCamH+kY2k/lHC4WoHW5WwZPWk0vCr6XeXYwoDy7Fs+E e2Gj9APGHJskF5baXM30ijcPd8HG3D6D/bF4AF2Pr9GdzX0a4ntax06/o+BKjfoFHP6L SMrOEpaS+Kk1zlYiEceoNXgMUkfmzWS/sOXcwbY4I0Xmi6pcTNSJDFZOsKej7dL6HrG3 MKYATZCHjR42yTmEsKs9ES5xG+o3gnUYwIcfgnIxUb4KZNS/+4Mxrg4xoJ3AUs22EIhI gOwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=35iftTChXhbYCh3E5Wk4+TdQiuf6+npXGgVuS6deYQI=; b=Z4PVh9vDN77JrGRmMjZ9KHUPr3+N1xq7fOvokD0651r4JwOnmf9Jqocr9w3/DRfve8 Aw+yqQNyyG3E56lDy7226Xbwz4ZySAzPx/aG/X/oZHLfYCAcxR4OOX1LlPt17ynq3Ayk bVRuiQIOapPnlChnTb0XKNFWQvUvg6dzrpnGaZ/RtXhRsx+EJF4ggVIAaN7HNTBzU+E9 IJiKZCOuYeJlmHujb/MjzGgcHFN0zBeDvCVgKdbecBagKxpnF9pkg1DealmvNH7/j6vt 5f0AQNjBdbcQM9nbRIoIHP2e7NkO9/9n0qGOla27iHRTEgrpgQXe3XdmMJ1G1/5eB/VC BiTQ== X-Gm-Message-State: AO0yUKXs/ZscpQ4Ru9LDuaP0DEqzM7OvTA7zQcNvCNQ/y1E0UxT14keb aWbxzkoWnaLGtmI2A1Y9VUqPvXRvbNl8lQ== X-Google-Smtp-Source: AK7set+I3+HAMstc/+EjgBNFTyogjTV1WS5EBay8wRJk94O0vC7+Zyur6PMv4TFmv9XcwDAEJ62iGw== X-Received: by 2002:a05:622a:a028:b0:3b9:bc8c:c209 with SMTP id jt40-20020a05622aa02800b003b9bc8cc209mr2458034qtb.20.1676428849447; Tue, 14 Feb 2023 18:40:49 -0800 (PST) Received: from cheska.uwo-x-22.wireless.uwo.pri (eclipse-22.wireless.uwo.ca. [129.100.255.37]) by smtp.googlemail.com with ESMTPSA id e184-20020a3769c1000000b0073b69922cfesm1069734qkc.85.2023.02.14.18.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 18:40:47 -0800 (PST) From: Shuqi Liang To: git@vger.kernel.org Cc: Shuqi Liang Subject: [PATCH v6 3/3] t4113: put executable lines to test_expect_success Date: Tue, 14 Feb 2023 21:39:53 -0500 Message-Id: <20230215023953.11880-4-cheskaqiqi@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230215023953.11880-1-cheskaqiqi@gmail.com> References: <20230209154417.10763-1-cheskaqiqi@gmail.com> <20230215023953.11880-1-cheskaqiqi@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As t/README says, put all code inside test_expect_success and other assertions. This old test scripts have setup code outside of tests. This is problematic since any failures of the setup code will go unnoticed. Therefore, move setup code into the tests themselves so that failures are properly flagged. t/README also says, use "<<-" instead of "<<" to strip leading TABs used for indentation. Fix it. We should chain test assertions(t/README). Therefore,Chain this test assertions with &&. What's more,take advantage of modern style. Use test_write_lines instead. Signed-off-by: Shuqi Liang --- t/t4113-apply-ending.sh | 55 ++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index a470c9ce7b..56fc2f436b 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -8,46 +8,39 @@ test_description='git apply trying to add an ending line. ' . ./test-lib.sh -# setup - -cat >test-patch <<\EOF -diff --git a/file b/file ---- a/file -+++ b/file -@@ -1,2 +1,3 @@ - a - b -+c -EOF - -echo 'a' >file -echo 'b' >>file -echo 'c' >>file - test_expect_success setup ' + cat >test-patch <<-\EOF && + diff --git a/file b/file + --- a/file + +++ b/file + @@ -1,2 +1,3 @@ + a + b + +c + EOF + + test_write_lines a b c >file && git update-index --add file ' -# test test_expect_success 'apply at the end' ' test_must_fail git apply --index test-patch ' -cat >test-patch <<\EOF -diff a/file b/file ---- a/file -+++ b/file -@@ -1,2 +1,3 @@ -+a - b - c -EOF - -echo >file 'a -b -c' -git update-index file test_expect_success 'apply at the beginning' ' + cat >test-patch <<-\EOF && + diff a/file b/file + --- a/file + +++ b/file + @@ -1,2 +1,3 @@ + +a + b + c + EOF + + test_write_lines a b c >file && + git update-index file && test_must_fail git apply --index test-patch ' + test_done