mbox series

[v3,0/3] modernize style

Message ID 20230205145245.11078-1-cheskaqiqi@gmail.com (mailing list archive)
Headers show
Series modernize style | expand

Message

Shuqi Liang Feb. 5, 2023, 2:52 p.m. UTC
different between V2:

1.change the commit massage in t4113: Modernize test script and t4113: indent with space.

2. Put the executable lines inside the test_expect_success.Mention the new style problem cause 
by this change,which is change the "<<" to "<<-" to strip leading TABs used for indentation.

Shuqi Liang (3):
  t/t4113-apply-ending.sh: Modernize test script
  t4113: put executable lines to test_expect_success
  t4113: indent with space

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

Range-diff against v2:
1:  d7d52f1f79 ! 1:  3d40bcce13 t/t4113-apply-ending.sh: Modernize a test script
    @@ Metadata
     Author: Shuqi Liang <cheskaqiqi@gmail.com>
     
      ## Commit message ##
    -    t/t4113-apply-ending.sh: Modernize a test script
    +    t/t4113-apply-ending.sh: Modernize test script
     
    +    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.
    +
    +    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:  d9e5a54e32 ! 2:  5c55b208a8 Test scripts in file t4113-apply-ending.sh, files "test-patch" and "file" are created twice.
    @@ Metadata
     Author: Shuqi Liang <cheskaqiqi@gmail.com>
     
      ## Commit message ##
    -    Test scripts in file t4113-apply-ending.sh, files
    -    "test-patch" and "file" are created twice.
    +    t4113: put executable lines to test_expect_success
     
    -    Make the second creation of the files its own step
    -    'setup for apply at the beginning'.
    +    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
     
         Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>
     
    @@ t/t4113-apply-ending.sh: test_description='git apply trying to add an ending lin
      
     -# setup
     -
    - cat >test-patch <<\EOF
    - diff --git a/file b/file
    - --- a/file
    -@@ t/t4113-apply-ending.sh: echo 'c' >>file
    +-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
    ++
    ++	echo 'a' >file
    ++	echo 'b' >>file
    ++	echo 'c' >>file
          git update-index --add file
      '
     -# test
    @@ -1,2 +1,3 @@
     -b
     -c'
     -git update-index file
    -+test_expect_success 'setup for apply at the beginning' '
    -+	cat >test-patch <<\EOF
    +-
    + test_expect_success 'apply at the beginning' '
    ++	cat >test-patch <<-\EOF
     +	diff a/file b/file
     +	--- a/file
     +	+++ b/file
    @@ -1,2 +1,3 @@
     +	b
     +	c'
     +	git update-index file
    -+'
    - 
    - test_expect_success 'apply at the beginning' '
          test_must_fail git apply --index test-patch
    + '
    + 
3:  01a5c3285e < -:  ---------- use "<<-" instead of "<<"
4:  cf2b2ca5a0 < -:  ---------- t4113-apply-ending.sh used 4-column indent with space,fix it in use tabs for indentation.
-:  ---------- > 3:  02b661279f t4113: indent with space