[PATCHv3 06/16] t3600 (rm): add lots of missing &&

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Elijah Newren
Date: Saturday, September 25, 2010 - 12:06 pm

Also delete unnecessary, failing code and add some test_when_finished
calls to make sure tests clean up after themselves.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t3600-rm.sh |   38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index b26cabd..b1f9abf 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -38,37 +38,33 @@ test_expect_success \
 
 test_expect_success \
     'Test that git rm --cached foo succeeds if the index matches the file' \
-    'echo content > foo
-     git add foo
+    'echo content > foo &&
+     git add foo &&
      git rm --cached foo'
 
 test_expect_success \
     'Test that git rm --cached foo succeeds if the index matches the file' \
-    'echo content > foo
-     git add foo
-     git commit -m foo
-     echo "other content" > foo
+    'echo content > foo &&
+     git add foo &&
+     git commit -m foo &&
+     echo "other content" > foo &&
+     test_when_finished "git checkout HEAD -- foo" &&
      git rm --cached foo'
 
 test_expect_success \
     'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
-     echo content > foo
-     git add foo
-     git commit -m foo
-     echo "other content" > foo
-     git add foo
-     echo "yet another content" > foo
+     echo "other content" > foo &&
+     git add foo &&
+     echo "yet another content" > foo &&
+     test_when_finished "git checkout HEAD -- foo" &&
      test_must_fail git rm --cached foo
 '
 
 test_expect_success \
     'Test that git rm --cached -f foo works in case where --cached only did not' \
-    'echo content > foo
-     git add foo
-     git commit -m foo
-     echo "other content" > foo
-     git add foo
-     echo "yet another content" > foo
+    'echo "other content" > foo &&
+     git add foo &&
+     echo "yet another content" > foo &&
      git rm --cached -f foo'
 
 test_expect_success \
@@ -170,7 +166,7 @@ test_expect_success 'but with -f it should work.' '
 	git rm -f foo baz &&
 	test ! -f foo &&
 	test ! -f baz &&
-	test_must_fail git ls-files --error-unmatch foo
+	test_must_fail git ls-files --error-unmatch foo &&
 	test_must_fail git ls-files --error-unmatch baz
 '
 
@@ -183,7 +179,7 @@ test_expect_success 'refuse to remove cached empty file with modifications' '
 
 test_expect_success 'remove intent-to-add file without --force' '
 	echo content >intent-to-add &&
-	git add -N intent-to-add
+	git add -N intent-to-add &&
 	git rm --cached intent-to-add
 '
 
@@ -201,7 +197,7 @@ test_expect_success 'Recursive without -r fails' '
 '
 
 test_expect_success 'Recursive with -r but dirty' '
-	echo qfwfq >>frotz/nitfol
+	echo qfwfq >>frotz/nitfol &&
 	test_must_fail git rm -r frotz &&
 	test -d frotz &&
 	test -f frotz/nitfol
-- 
1.7.3.95.g14291

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCHv3 00/16] Add missing &amp;&amp;'s in the testsuite, Elijah Newren, (Sat Sep 25, 12:06 pm)
[PATCHv3 06/16] t3600 (rm): add lots of missing &&, Elijah Newren, (Sat Sep 25, 12:06 pm)
[PATCHv3 08/16] t4026 (color): add missing &amp;&amp;, Elijah Newren, (Sat Sep 25, 12:06 pm)
[PATCHv3 11/16] t6050 (replace): add missing &amp;&amp;, Elijah Newren, (Sat Sep 25, 12:07 pm)
[PATCHv3 12/16] t7001 (mv): add missing &amp;&amp;, Elijah Newren, (Sat Sep 25, 12:07 pm)
[PATCHv3 14/16] t7800 (difftool): add missing &amp;&amp;, Elijah Newren, (Sat Sep 25, 12:07 pm)
Re: [PATCHv3 15/16] Add missing &amp;&amp;'s throughout the testsuite, Ævar Arnfjörð Bjarmason, (Sat Sep 25, 12:38 pm)
Re: [PATCHv3 00/16] Add missing &amp;&amp;'s in the testsuite, Ævar Arnfjörð Bjarmason, (Sat Sep 25, 12:39 pm)
Re: [PATCHv3 11/16] t6050 (replace): add missing &amp;&amp;, Christian Couder, (Sat Sep 25, 10:22 pm)
Re: [PATCHv3 08/16] t4026 (color): add missing &amp;&amp;, Elijah Newren, (Sun Sep 26, 5:39 am)