All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuqi Liang <cheskaqiqi@gmail.com>
To: git@vger.kernel.org
Cc: Shuqi Liang <cheskaqiqi@gmail.com>
Subject: [PATCH v6 0/3] t4113: modernize style
Date: Tue, 14 Feb 2023 21:39:50 -0500	[thread overview]
Message-ID: <20230215023953.11880-1-cheskaqiqi@gmail.com> (raw)
In-Reply-To: <20230209154417.10763-1-cheskaqiqi@gmail.com>

different with 5 :

1.change the commit message to be more succinct.

2.
use  

test_write_lines a b c >file && 

instead of :
 
{
    echo a &&
    echo b &&
    echo c
} >file &&




Shuqi Liang (3):
  t4113: modernize test script
  t4113: indent with tab
  t4113: put executable lines to test_expect_success

 t/t4113-apply-ending.sh | 75 +++++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 41 deletions(-)

Range-diff against v5:
1:  4d55e522a6 ! 1:  cb29da5d42 t4113: modernize test script
    @@ Commit message
         where the test_expect_success command and test title are written on
         separate lines. Change the old style to modern style.
     
    -    for example :
    -    -test_expect_success setup \
    -    -    'git update-index --add file'
    -    -
    -    +test_expect_success setup '
    -    +    git update-index --add file
    -    +'
    -
         Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>
     
      ## t/t4113-apply-ending.sh ##
2:  cb997bc422 = 2:  09efa23ba4 t4113: indent with tab
3:  726d2fcb47 ! 3:  0169cbd402 t4113: put executable lines to test_expect_success
    @@ Commit message
         t4113: put executable lines to test_expect_success
     
         As t/README says, put all code inside test_expect_success and
    -    other assertions. This script is written in old style,where there are
    -    some executable lines outside test_expect_success. Put the executable
    -    lines inside the test_expect_success.
    -
    -    As t/README says,use "<<-" instead of "<<"
    -    to strip leading TABs used for indentation. Change the "<<" to "<<-"
    -
    -    for example:
    -    -cat >test-patch <<\EOF
    -    -diff a/file b/file
    -
    -     test_expect_success 'apply at the beginning' '
    -    +       cat >test-patch <<-\EOF
    -    +       diff a/file b/file
    -    +       --- a/file
    -
    -    As t/README says,chain test assertions.Chain this test assertions
    -    with &&.
    -
    -    For example:
    -
    -    -cat >test-patch <<\EOF
    -    -diff --git a/file b/file
    -
    -    + cat >test-patch <<-\EOF &&
    -    + diff --git a/file b/file
    -
    -    This script is written in old style,where there are something like
    -
    -            echo x >file &&
    -            echo y >>file &&
    -            echo z >>file
    -
    -      Change it to this stlye :
    -            {
    -            echo x &&
    -            echo y &&
    -            echo z
    -            } >file
    -
    -    In order to escape for executable lines inside the test_expect_success.
    -    Change ' in executable lines to '\'' in order to escape.
    +    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 <cheskaqiqi@gmail.com>
     
    @@ -1,2 +1,3 @@
     +	+c
     +	EOF
     +
    -+	{
    -+	echo '\''a'\'' &&
    -+	echo '\''b'\'' &&
    -+	echo '\''c'\''
    -+	} >file &&
    ++	test_write_lines a b c >file &&
      	git update-index --add file
      '
     -# test
    @@ -1,2 +1,3 @@
     +	 c
     +	EOF
     +
    -+	echo >file '\''a
    -+	b
    -+	c'\'' &&
    ++	test_write_lines a b c >file &&
     +	git update-index file &&
      	test_must_fail git apply --index test-patch
      '
-- 
2.39.0


  parent reply	other threads:[~2023-02-15  2:40 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 22:49 [GSoC][PATCH] t/t4113-apply-ending.sh: Modernize a test script Shuqi Liang
2023-02-01  2:21 ` Andrei Rybak
2023-02-02 17:20   ` cheska fran
2023-02-02 17:18 ` [PATCH v2 0/4] t4113: modernize test style Shuqi Liang
2023-02-02 17:18   ` [PATCH v2 1/4]t4113: replace backslash with single quote Shuqi Liang
2023-02-02 21:00     ` Junio C Hamano
2023-02-05 14:28       ` Shuqi Liang
2023-02-02 17:18   ` [PATCH v2 2/4] t4113:put second creation in own step Shuqi Liang
2023-02-02 17:18   ` [PATCH v2 3/4] t4113: use "<<-" instead of "<<" Shuqi Liang
2023-02-02 21:05     ` Junio C Hamano
2023-02-05 14:38       ` Shuqi Liang
2023-02-02 17:18   ` [PATCH v2 4/4] t4113: indent with tabs Shuqi Liang
2023-02-02 21:10     ` Junio C Hamano
2023-02-05 14:51       ` Shuqi Liang
2023-02-05 14:52   ` [PATCH v3 0/3] modernize style Shuqi Liang
2023-02-05 14:52     ` [PATCH v3 1/3]t4113: modernize a test script Shuqi Liang
2023-02-05 14:52     ` [PATCH v3 2/3] t4113: put executable lines to test_expect_success Shuqi Liang
2023-02-05 14:52     ` [PATCH v3 3/3] t4113: indent with space Shuqi Liang
2023-02-05 20:29       ` Eric Sunshine
2023-02-06 21:17         ` Shuqi Liang
2023-02-06 21:18     ` [PATCH v4 0/3] t4113: modernize style Shuqi Liang
2023-02-06 21:18       ` [PATCH v4 1/3] t4113: modernize test script Shuqi Liang
2023-02-06 21:18       ` [PATCH v4 2/3] t4113: indent with tab Shuqi Liang
2023-02-06 21:18       ` [PATCH v4 3/3] t4113: put executable lines to test_expect_success Shuqi Liang
2023-02-06 21:50         ` Ævar Arnfjörð Bjarmason
2023-02-06 22:44         ` Junio C Hamano
2023-02-06 23:42           ` Shuqi Liang
2023-02-07  8:05             ` Ævar Arnfjörð Bjarmason
2023-02-07 19:55               ` Shuqi Liang
2023-02-08  5:44               ` Shuqi Liang
2023-02-08  7:44                 ` Ævar Arnfjörð Bjarmason
2023-02-10 15:29                   ` Shuqi Liang
2023-02-15  0:34                   ` Eric Sunshine
2023-02-15  0:26               ` Eric Sunshine
2023-02-14 22:17           ` Shuqi Liang
2023-02-14 22:29             ` Junio C Hamano
2023-02-09 15:44       ` [PATCH v5 0/3] t4113: modernize style Shuqi Liang
2023-02-09 15:44         ` [PATCH v5 1/3] t4113: modernize test script Shuqi Liang
2023-02-09 15:44         ` [PATCH v5 2/3] t4113: indent with tab Shuqi Liang
2023-02-15  0:10           ` Eric Sunshine
2023-02-15  0:18             ` Shuqi Liang
2023-02-09 15:44         ` [PATCH v5 3/3] t4113: put executable lines to test_expect_success Shuqi Liang
2023-02-15  1:09           ` Eric Sunshine
2023-02-15  2:40             ` Shuqi Liang
2023-02-15  2:38         ` [PATCH v6 0/3] t4113: modernize style Shuqi Liang
2023-02-15  2:39         ` Shuqi Liang [this message]
2023-02-15  2:39           ` [PATCH v6 1/3] t4113: modernize test script Shuqi Liang
2023-02-15  2:39           ` [PATCH v6 2/3] t4113: indent with tab Shuqi Liang
2023-02-15  2:39           ` [PATCH v6 3/3] t4113: put executable lines to test_expect_success Shuqi Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230215023953.11880-1-cheskaqiqi@gmail.com \
    --to=cheskaqiqi@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.