summaryrefslogtreecommitdiff
path: root/t/t7102-reset.sh
diff options
context:
space:
mode:
authorStephan Beyer <s-beyer@gmx.net>2008-07-12 15:47:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-07-13 20:21:26 (GMT)
commitd492b31cafe9aa5ce001b1d48815f4c0bb40d01a (patch)
tree9782e7f8110a866423b8d752783e0fcddc8c0508 /t/t7102-reset.sh
parent5a26973025bce74782571844c7b8091d1cd7c405 (diff)
downloadgit-d492b31cafe9aa5ce001b1d48815f4c0bb40d01a.zip
git-d492b31cafe9aa5ce001b1d48815f4c0bb40d01a.tar.gz
git-d492b31cafe9aa5ce001b1d48815f4c0bb40d01a.tar.bz2
t/: Use "test_must_fail git" instead of "! git"
This patch changes every occurrence of "! git" -- with the meaning that a git call has to gracefully fail -- into "test_must_fail git". This is useful to - make sure the test does not fail because of a signal, e.g. SIGSEGV, and - advertise the use of "test_must_fail" for new tests. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7102-reset.sh')
-rwxr-xr-xt/t7102-reset.sh48
1 files changed, 24 insertions, 24 deletions
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 96d1508..0bfc1e9 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -52,10 +52,10 @@ secondfile:
EOF
test_expect_success 'giving a non existing revision should fail' '
- ! git reset aaaaaa &&
- ! git reset --mixed aaaaaa &&
- ! git reset --soft aaaaaa &&
- ! git reset --hard aaaaaa &&
+ test_must_fail git reset aaaaaa &&
+ test_must_fail git reset --mixed aaaaaa &&
+ test_must_fail git reset --soft aaaaaa &&
+ test_must_fail git reset --hard aaaaaa &&
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
'
@@ -63,29 +63,29 @@ test_expect_success 'reset --soft with unmerged index should fail' '
touch .git/MERGE_HEAD &&
echo "100644 44c5b5884550c17758737edcced463447b91d42b 1 un" |
git update-index --index-info &&
- ! git reset --soft HEAD &&
+ test_must_fail git reset --soft HEAD &&
rm .git/MERGE_HEAD &&
git rm --cached -- un
'
test_expect_success \
'giving paths with options different than --mixed should fail' '
- ! git reset --soft -- first &&
- ! git reset --hard -- first &&
- ! git reset --soft HEAD^ -- first &&
- ! git reset --hard HEAD^ -- first &&
+ test_must_fail git reset --soft -- first &&
+ test_must_fail git reset --hard -- first &&
+ test_must_fail git reset --soft HEAD^ -- first &&
+ test_must_fail git reset --hard HEAD^ -- first &&
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
'
test_expect_success 'giving unrecognized options should fail' '
- ! git reset --other &&
- ! git reset -o &&
- ! git reset --mixed --other &&
- ! git reset --mixed -o &&
- ! git reset --soft --other &&
- ! git reset --soft -o &&
- ! git reset --hard --other &&
- ! git reset --hard -o &&
+ test_must_fail git reset --other &&
+ test_must_fail git reset -o &&
+ test_must_fail git reset --mixed --other &&
+ test_must_fail git reset --mixed -o &&
+ test_must_fail git reset --soft --other &&
+ test_must_fail git reset --soft -o &&
+ test_must_fail git reset --hard --other &&
+ test_must_fail git reset --hard -o &&
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
'
@@ -102,8 +102,8 @@ test_expect_success \
echo "3rd line in branch2" >>secondfile &&
git commit -a -m "change in branch2" &&
- ! git merge branch1 &&
- ! git reset --soft &&
+ test_must_fail git merge branch1 &&
+ test_must_fail git reset --soft &&
printf "1st line 2nd file\n2nd line 2nd file\n3rd line" >secondfile &&
git commit -a -m "the change in branch2" &&
@@ -126,7 +126,7 @@ test_expect_success \
echo "3rd line in branch4" >>secondfile &&
git checkout -m branch3 &&
- ! git reset --soft &&
+ test_must_fail git reset --soft &&
printf "1st line 2nd file\n2nd line 2nd file\n3rd line" >secondfile &&
git commit -a -m "the line in branch3" &&
@@ -326,7 +326,7 @@ test_expect_success '--hard reset to HEAD should clear a failed merge' '
echo "3rd line in branch2" >>secondfile &&
git commit -a -m "change in branch2" &&
- ! git pull . branch1 &&
+ test_must_fail git pull . branch1 &&
git reset --hard &&
check_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb
'
@@ -388,7 +388,7 @@ test_expect_success 'test --mixed <paths>' '
echo 4 > file4 &&
echo 5 > file1 &&
git add file1 file3 file4 &&
- ! git reset HEAD -- file1 file2 file3 &&
+ test_must_fail git reset HEAD -- file1 file2 file3 &&
git diff > output &&
test_cmp output expect &&
git diff --cached > output &&
@@ -402,11 +402,11 @@ test_expect_success 'test resetting the index at give paths' '
>sub/file2 &&
git update-index --add sub/file1 sub/file2 &&
T=$(git write-tree) &&
- ! git reset HEAD sub/file2 &&
+ test_must_fail git reset HEAD sub/file2 &&
U=$(git write-tree) &&
echo "$T" &&
echo "$U" &&
- ! git diff-index --cached --exit-code "$T" &&
+ test_must_fail git diff-index --cached --exit-code "$T" &&
test "$T" != "$U"
'