threads / patch / 59299

patch, 3 partst9700:moderizen test scripts

Subject: [GSOC] [PATCH 0/3] t9700:moderizen test scripts

## tl;dr

4 messages between Feb 23, 2023 and Feb 23, 2023. Diffs are folded; open one to read it.

replies: 3people: 1as markdown or json

Zhang Yi· Feb 23, 2023, 14:15 UTC · lore
The style of t9700-perl-git.sh is old.There are 3 things need improve:
* A title is not on the same line with test_expect_success command.
* A test body is indented by whitespaces.
* There are whitespaces after redirect operators.

--- Thanks for all suggestions.

Zhang Yi (3):
  t9700:fix title style
  t9700:change indents to TAB
  t9700:delete whitespaces after redirect operators
 t/t9700-perl-git.sh | 61 ++++++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 31 deletions(-)
-- 
2.29.0-rc0
Zhang Yi· Feb 23, 2023, 14:15 UTC · re: Zhang Yi · lore

[GSOC] [PATCH v2 2/3] t9700:change indents to TAB

The body of one test script in t9700-perl-git.sh is indented by spaces while others are indented by TAB.And test bodies should be indented with TAB, not spaces.

Replace all space indents by TAB.
Signed-off-by: Zhang Yi <18994118902@163.com>
---
 t/t9700-perl-git.sh | 58 ++++++++++++++++++++++-----------------------
 1 file changed, 29 insertions(+), 29 deletions(-)
Show changes to t/t9700-perl-git.sh +29 −29
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index 3f6396ef63..671875a3fc 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -14,35 +14,35 @@ skip_all_if_no_Test_More
 # set up test repository
 
 test_expect_success 'set up test repository' '
-     echo "test file 1" > file1 &&
-     echo "test file 2" > file2 &&
-     mkdir directory1 &&
-     echo "in directory1" >> directory1/file &&
-     mkdir directory2 &&
-     echo "in directory2" >> directory2/file &&
-     git add . &&
-     git commit -m "first commit" &&
-
-     echo "new file in subdir 2" > directory2/file2 &&
-     git add . &&
-     git commit -m "commit in directory2" &&
-
-     echo "changed file 1" > file1 &&
-     git commit -a -m "second commit" &&
-
-     git config --add color.test.slot1 green &&
-     git config --add test.string value &&
-     git config --add test.dupstring value1 &&
-     git config --add test.dupstring value2 &&
-     git config --add test.booltrue true &&
-     git config --add test.boolfalse no &&
-     git config --add test.boolother other &&
-     git config --add test.int 2k &&
-     git config --add test.path "~/foo" &&
-     git config --add test.pathexpanded "$HOME/foo" &&
-     git config --add test.pathmulti foo &&
-     git config --add test.pathmulti bar
-     '
+	echo "test file 1" > file1 &&
+	echo "test file 2" > file2 &&
+	mkdir directory1 &&
+	echo "in directory1" >> directory1/file &&
+	mkdir directory2 &&
+	echo "in directory2" >> directory2/file &&
+	git add . &&
+	git commit -m "first commit" &&
+
+	echo "new file in subdir 2" > directory2/file2 &&
+	git add . &&
+	git commit -m "commit in directory2" &&
+
+	echo "changed file 1" > file1 &&
+	git commit -a -m "second commit" &&
+
+	git config --add color.test.slot1 green &&
+	git config --add test.string value &&
+	git config --add test.dupstring value1 &&
+	git config --add test.dupstring value2 &&
+	git config --add test.booltrue true &&
+	git config --add test.boolfalse no &&
+	git config --add test.boolother other &&
+	git config --add test.int 2k &&
+	git config --add test.path "~/foo" &&
+	git config --add test.pathexpanded "$HOME/foo" &&
+	git config --add test.pathmulti foo &&
+	git config --add test.pathmulti bar
+'
 
 test_expect_success 'set up bare repository' '
 	git init --bare bare.git
-- 
2.29.0-rc0
Zhang Yi· Feb 23, 2023, 14:15 UTC · re: Zhang Yi · lore

[GSOC] [PATCH v2 1/3] t9700:fix title style

One title in t9700-perl-git.sh is in old style where the test_expect_success command and test title are written on separate lines.

Combine the test_expect_success command and the title in one line.
Signed-off-by: Zhang Yi <18994118902@163.com>
---
 t/t9700-perl-git.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Show changes to t/t9700-perl-git.sh +2 −3
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index b105d6d9d5..3f6396ef63 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -13,9 +13,8 @@ skip_all_if_no_Test_More
 
 # set up test repository
 
-test_expect_success \
-    'set up test repository' \
-    'echo "test file 1" > file1 &&
+test_expect_success 'set up test repository' '
+     echo "test file 1" > file1 &&
      echo "test file 2" > file2 &&
      mkdir directory1 &&
      echo "in directory1" >> directory1/file &&
-- 
2.29.0-rc0
Zhang Yi· Feb 23, 2023, 14:15 UTC · re: Zhang Yi · lore

[GSOC] [PATCH v2 3/3] t9700:delete whitespaces after redirect operators

There are whitespaces after redirect operators,which is a deprecated style.

Delete whitespaces after redirect operators.
Signed-off-by: Zhang Yi <18994118902@163.com>
---
 t/t9700-perl-git.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Show changes to t/t9700-perl-git.sh +6 −6
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index 671875a3fc..ccc8212d73 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -14,20 +14,20 @@ skip_all_if_no_Test_More
 # set up test repository
 
 test_expect_success 'set up test repository' '
-	echo "test file 1" > file1 &&
-	echo "test file 2" > file2 &&
+	echo "test file 1" >file1 &&
+	echo "test file 2" >file2 &&
 	mkdir directory1 &&
-	echo "in directory1" >> directory1/file &&
+	echo "in directory1" >>directory1/file &&
 	mkdir directory2 &&
-	echo "in directory2" >> directory2/file &&
+	echo "in directory2" >>directory2/file &&
 	git add . &&
 	git commit -m "first commit" &&
 
-	echo "new file in subdir 2" > directory2/file2 &&
+	echo "new file in subdir 2" >directory2/file2 &&
 	git add . &&
 	git commit -m "commit in directory2" &&
 
-	echo "changed file 1" > file1 &&
+	echo "changed file 1" >file1 &&
 	git commit -a -m "second commit" &&
 
 	git config --add color.test.slot1 green &&
-- 
2.29.0-rc0

← back to recent threads