git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v6 1/5][Outreachy] t7101,t7102,t7201: modernize test formatting

From
Charvi Mendiratta <charvi077@gmail.com>
Date
Oct 22, 2020, 07:16 UTC
Message-ID
<20201022071649.24284-2-charvi077@gmail.com>
In-Reply-To
<20201021124823.2217-1-charvi077@gmail.com>
Some tests in these scripts are formatted using a very old style:
        test_expect_success \
            'title' \
            'body line 1 &&
             body line 2'
Updating the formatting to the modern style:
        test_expect_success 'title' '
            body line 1 &&
            body line 2
        '
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
---
 t/t7101-reset-empty-subdirs.sh | 66 +++++++++++++++++-----------------
 t/t7102-reset.sh               | 24 +++++--------
 t/t7201-co.sh                  | 31 ++++++++--------
 3 files changed, 56 insertions(+), 65 deletions(-)
diff --git a/t/t7101-reset-empty-subdirs.sh b/t/t7101-reset-empty-subdirs.sh
index 96e163f084..bfce05ac5d 100755
--- a/t/t7101-reset-empty-subdirs.sh
+++ b/t/t7101-reset-empty-subdirs.sh
@@ -6,16 +6,15 @@
 test_description='git reset should cull empty subdirs'
 . ./test-lib.sh
 
-test_expect_success \
-    'creating initial files' \
-    'mkdir path0 &&
+test_expect_success 'creating initial files' '
+     mkdir path0 &&
      cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
      git add path0/COPYING &&
-     git commit -m add -a'
+     git commit -m add -a
+'
 
-test_expect_success \
-    'creating second files' \
-    'mkdir path1 &&
+test_expect_success 'creating second files' '
+     mkdir path1 &&
      mkdir path1/path2 &&
      cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
      cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
@@ -25,39 +24,40 @@ test_expect_success \
      git add path1/COPYING &&
      git add COPYING &&
      git add path0/COPYING-TOO &&
-     git commit -m change -a'
+     git commit -m change -a
+'
 
-test_expect_success \
-    'resetting tree HEAD^' \
-    'git reset --hard HEAD^'
+test_expect_success 'resetting tree HEAD^' '
+     git reset --hard HEAD^
+'
 
-test_expect_success \
-    'checking initial files exist after rewind' \
-    'test -d path0 &&
-     test -f path0/COPYING'
+test_expect_success 'checking initial files exist after rewind' '
+     test -d path0 &&
+     test -f path0/COPYING
+'
 
-test_expect_success \
-    'checking lack of path1/path2/COPYING' \
-    '! test -f path1/path2/COPYING'
+test_expect_success 'checking lack of path1/path2/COPYING' '
+    ! test -f path1/path2/COPYING
+'
 
-test_expect_success \
-    'checking lack of path1/COPYING' \
-    '! test -f path1/COPYING'
+test_expect_success 'checking lack of path1/COPYING' '
+    ! test -f path1/COPYING
+'
 
-test_expect_success \
-    'checking lack of COPYING' \
-    '! test -f COPYING'
+test_expect_success 'checking lack of COPYING' '
+     ! test -f COPYING
+'
 
-test_expect_success \
-    'checking checking lack of path1/COPYING-TOO' \
-    '! test -f path0/COPYING-TOO'
+test_expect_success 'checking checking lack of path1/COPYING-TOO' '
+     ! test -f path0/COPYING-TOO
+'
 
-test_expect_success \
-    'checking lack of path1/path2' \
-    '! test -d path1/path2'
+test_expect_success 'checking lack of path1/path2' '
+     ! test -d path1/path2
+'
 
-test_expect_success \
-    'checking lack of path1' \
-    '! test -d path1'
+test_expect_success 'checking lack of path1' '
+     ! test -d path1
+'
 
 test_done
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 22161b3b2d..fe43f77513 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -107,8 +107,7 @@ test_expect_success 'reset --soft with unmerged index should fail' '
 	git rm --cached -- un
 '
 
-test_expect_success \
-	'giving paths with options different than --mixed should fail' '
+test_expect_success 'giving paths with options different than --mixed should fail' '
 	test_must_fail git reset --soft -- first &&
 	test_must_fail git reset --hard -- first &&
 	test_must_fail git reset --soft HEAD^ -- first &&
@@ -128,8 +127,7 @@ test_expect_success 'giving unrecognized options should fail' '
 	check_changes $head5
 '
 
-test_expect_success \
-	'trying to do reset --soft with pending merge should fail' '
+test_expect_success 'trying to do reset --soft with pending merge should fail' '
 	git branch branch1 &&
 	git branch branch2 &&
 
@@ -152,8 +150,7 @@ test_expect_success \
 	check_changes $head5
 '
 
-test_expect_success \
-	'trying to do reset --soft with pending checkout merge should fail' '
+test_expect_success 'trying to do reset --soft with pending checkout merge should fail' '
 	git branch branch3 &&
 	git branch branch4 &&
 
@@ -175,8 +172,7 @@ test_expect_success \
 	check_changes $head5
 '
 
-test_expect_success \
-	'resetting to HEAD with no changes should succeed and do nothing' '
+test_expect_success 'resetting to HEAD with no changes should succeed and do nothing' '
 	git reset --hard &&
 		check_changes $head5 &&
 	git reset --hard HEAD &&
@@ -226,8 +222,7 @@ secondfile:
 2nd line 2nd file
 3rd line 2nd file
 EOF
-test_expect_success \
-	'changing files and redo the last commit should succeed' '
+test_expect_success 'changing files and redo the last commit should succeed' '
 	echo "3rd line 2nd file" >>secondfile &&
 	git commit -a -C ORIG_HEAD &&
 	head4=$(git rev-parse --verify HEAD) &&
@@ -245,8 +240,7 @@ first:
 second:
 2nd file
 EOF
-test_expect_success \
-	'--hard reset should change the files and undo commits permanently' '
+test_expect_success '--hard reset should change the files and undo commits permanently' '
 	git reset --hard HEAD~2 &&
 	check_changes $head5p2 &&
 	test "$(git rev-parse ORIG_HEAD)" = \
@@ -284,8 +278,7 @@ secondfile:
 1st line 2nd file
 2nd line 2nd file
 EOF
-test_expect_success \
-	'redoing changes adding them without commit them should succeed' '
+test_expect_success 'redoing changes adding them without commit them should succeed' '
 	git rm first &&
 	git mv second secondfile &&
 
@@ -380,8 +373,7 @@ secondfile:
 1st line 2nd file
 2nd line 2nd file
 EOF
-test_expect_success \
-	'--hard reset to ORIG_HEAD should clear a fast-forward merge' '
+test_expect_success '--hard reset to ORIG_HEAD should clear a fast-forward merge' '
 	git reset --hard HEAD^ &&
 	check_changes $head5 &&
 
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 4d62b9b00f..a800bda5e3 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -62,7 +62,7 @@ test_expect_success setup '
 	git checkout master
 '
 
-test_expect_success "checkout from non-existing branch" '
+test_expect_success 'checkout from non-existing branch' '
 
 	git checkout -b delete-me master &&
 	git update-ref -d --no-deref refs/heads/delete-me &&
@@ -71,7 +71,7 @@ test_expect_success "checkout from non-existing branch" '
 	test refs/heads/master = "$(git symbolic-ref HEAD)"
 '
 
-test_expect_success "checkout with dirty tree without -m" '
+test_expect_success 'checkout with dirty tree without -m' '
 
 	fill 0 1 2 3 4 5 6 7 8 >one &&
 	if git checkout side
@@ -84,7 +84,7 @@ test_expect_success "checkout with dirty tree without -m" '
 
 '
 
-test_expect_success "checkout with unrelated dirty tree without -m" '
+test_expect_success 'checkout with unrelated dirty tree without -m' '
 
 	git checkout -f master &&
 	fill 0 1 2 3 4 5 6 7 8 >same &&
@@ -95,7 +95,7 @@ test_expect_success "checkout with unrelated dirty tree without -m" '
 	test_cmp messages.expect messages
 '
 
-test_expect_success "checkout -m with dirty tree" '
+test_expect_success 'checkout -m with dirty tree' '
 
 	git checkout -f master &&
 	git clean -f &&
@@ -120,7 +120,7 @@ test_expect_success "checkout -m with dirty tree" '
 	test_must_be_empty current.index
 '
 
-test_expect_success "checkout -m with dirty tree, renamed" '
+test_expect_success 'checkout -m with dirty tree, renamed' '
 
 	git checkout -f master && git clean -f &&
 
@@ -388,22 +388,22 @@ test_expect_success 'checkout specific path while in subdirectory' '
 
 '
 
-test_expect_success \
-    'checkout w/--track sets up tracking' '
+test_expect_success 'checkout w/--track sets up tracking' '
     git config branch.autosetupmerge false &&
     git checkout master &&
     git checkout --track -b track1 &&
     test "$(git config branch.track1.remote)" &&
-    test "$(git config branch.track1.merge)"'
+    test "$(git config branch.track1.merge)"
+'
 
-test_expect_success \
-    'checkout w/autosetupmerge=always sets up tracking' '
+test_expect_success 'checkout w/autosetupmerge=always sets up tracking' '
     test_when_finished git config branch.autosetupmerge false &&
     git config branch.autosetupmerge always &&
     git checkout master &&
     git checkout -b track2 &&
     test "$(git config branch.track2.remote)" &&
-    test "$(git config branch.track2.merge)"'
+    test "$(git config branch.track2.merge)"
+'
 
 test_expect_success 'checkout w/--track from non-branch HEAD fails' '
     git checkout master^0 &&
@@ -435,8 +435,7 @@ test_expect_success 'detach a symbolic link HEAD' '
     test "z$(git rev-parse --verify refs/heads/master)" = "z$here"
 '
 
-test_expect_success \
-    'checkout with --track fakes a sensible -b <name>' '
+test_expect_success 'checkout with --track fakes a sensible -b <name>' '
     git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" &&
     git update-ref refs/remotes/origin/koala/bear renamer &&
 
@@ -457,9 +456,9 @@ test_expect_success \
     test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
 '
 
-test_expect_success \
-    'checkout with --track, but without -b, fails with too short tracked name' '
-    test_must_fail git checkout --track renamer'
+test_expect_success 'checkout with --track, but without -b, fails with too short tracked name' '
+    test_must_fail git checkout --track renamer
+'
 
 setup_conflicting_index () {
 	rm -f .git/index &&
-- 
2.29.0.rc1
Previous: Charvi MendirattaNext: Charvi Mendiratta
Message 56 of 60 in “[Outreachy] modernizing the test scripts”
  1. 0/5 [Outreachy] modernizing the test scriptscharvi-077, Oct 15, 2020
  2. 1/5 [Outreachy] t7101,t7102,t7201: modernize test formattingcharvi-077, Oct 15, 2020
  3. Christian CouderOct 16, 2020
  4. 2/5 [Outreachy] t7102,t7201: remove unnecessary blank spaces in test bodycharvi-077, Oct 15, 2020
  5. 3/5 [Outreachy] t7102,t7201: remove whitespace after redirect operatorcharvi-077, Oct 15, 2020
  6. 4/5 [Outreachy] t7201: avoid using cd outside of subshellscharvi-077, Oct 15, 2020
  7. 5/5 [Outreachy] t7201: place each command in its own linecharvi-077, Oct 15, 2020
  8. Christian CouderOct 16, 2020
  9. Charvi MendirattaOct 17, 2020
  10. 0/5 [Outreachy] modernizing the test scriptsCharvi Mendiratta, Oct 17, 2020
  11. 1/5 [Outreachy] t7101,t7102,t7201: modernize test formattingCharvi Mendiratta, Oct 17, 2020
  12. 2/5 [Outreachy] t7102,t7201: remove unnecessary blank spaces in test bodyCharvi Mendiratta, Oct 17, 2020
  13. Đoàn Trần Công DanhOct 17, 2020
  14. Charvi MendirattaOct 18, 2020
  15. 3/5 [Outreachy] t7102,t7201: remove whitespace after redirect operatorCharvi Mendiratta, Oct 17, 2020
  16. 4/5 [Outreachy] t7201: avoid using cd outside of subshellsCharvi Mendiratta, Oct 17, 2020
  17. Phillip WoodOct 18, 2020
  18. Charvi MendirattaOct 19, 2020
  19. Phillip WoodOct 19, 2020
  20. Charvi MendirattaOct 19, 2020
  21. Taylor BlauOct 19, 2020
  22. Charvi MendirattaOct 20, 2020
  23. Taylor BlauOct 20, 2020
  24. Phillip WoodOct 20, 2020
  25. Charvi MendirattaOct 20, 2020
  26. 5/5 [Outreachy] t7201: place each command in its own lineCharvi Mendiratta, Oct 17, 2020
  27. 0/5 [Outreachy] modernize the test scriptsCharvi Mendiratta, Oct 20, 2020
  28. 1/5 [Outreachy] t7101,t7102,t7201: modernize test formattingCharvi Mendiratta, Oct 20, 2020
  29. 2/5 [Outreachy] t7102,t7201: remove unnecessary blank spaces in test bodyCharvi Mendiratta, Oct 20, 2020
  30. 3/5 [Outreachy] t7102,t7201: remove whitespace after redirect operatorCharvi Mendiratta, Oct 20, 2020
  31. 4/5 [Outreachy] t7201: use 'git -C' to avoid subshellCharvi Mendiratta, Oct 20, 2020
  32. 5/5 [Outreachy] t7201: put each command on a seperate lineCharvi Mendiratta, Oct 20, 2020
  33. t7201: put each command on a separate lineCharvi Mendiratta, Oct 20, 2020
  34. Junio C HamanoOct 20, 2020
  35. Taylor BlauOct 20, 2020
  36. Junio C HamanoOct 20, 2020
  37. Taylor BlauOct 20, 2020
  38. Junio C HamanoOct 20, 2020
  39. Charvi MendirattaOct 21, 2020
  40. Junio C HamanoOct 20, 2020
  41. Charvi MendirattaOct 21, 2020
  42. 0/5 [Outreachy] modernize the test scriptsCharvi Mendiratta, Oct 21, 2020
  43. 1/5 [Outreachy] t7101,t7102,t7201: modernize test formattingCharvi Mendiratta, Oct 21, 2020
  44. 2/5 [Outreachy] t7102,t7201: remove unnecessary blank spaces in test bodyCharvi Mendiratta, Oct 21, 2020
  45. 3/5 [Outreachy] t7102,t7201: remove whitespace after redirect operatorCharvi Mendiratta, Oct 21, 2020
  46. Eric SunshineOct 21, 2020
  47. Junio C HamanoOct 22, 2020
  48. Eric SunshineOct 22, 2020
  49. Junio C HamanoOct 22, 2020
  50. Eric SunshineOct 22, 2020
  51. Junio C HamanoOct 22, 2020
  52. Charvi MendirattaOct 22, 2020
  53. 4/5 [Outreachy] t7201: use 'git -C' to avoid subshellCharvi Mendiratta, Oct 21, 2020
  54. 5/5 [Outreachy] t7201: put each command on a separate lineCharvi Mendiratta, Oct 21, 2020
  55. 0/5 [Outreachy] modernize test scriptsCharvi Mendiratta, Oct 22, 2020
  56. 1/5 [Outreachy] t7101,t7102,t7201: modernize test formattingCharvi Mendiratta, Oct 22, 2020
  57. 2/5 [Outreachy] t7102,t7201: remove unnecessary blank spaces in test bodyCharvi Mendiratta, Oct 22, 2020
  58. 3/5 [Outreachy] t7102,t7201: remove whitespace after redirect operatorCharvi Mendiratta, Oct 22, 2020
  59. 4/5 [Outreachy] t7201: use 'git -C' to avoid subshellCharvi Mendiratta, Oct 22, 2020
  60. 5/5 [Outreachy] t7201: put each command on a separate lineCharvi Mendiratta, Oct 22, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.