This is the opposite of test_expect_success. If <script>
yields success, test is considered a failure.
- Example:
-
- test_expect_failure \
- 'git-update-index without --add should fail adding.' \
- 'git-update-index should-be-empty'
+ This should _not_ be used for tests that succeed when their
+ commands fail -- use test_expect_success and shell negation (!) for
+ that. test_expect_failure is for cases when a test is known to be
+ broken.
- test_debug <script>
stg id foo@x/y/z &&
stg id foo@x/y/z//top'
-test_expect_failure 'Try old id with slashy branch' \
- 'stg id foo/ ||
- stg id foo/top ||
- stg id foo@x/y/z/top'
+test_expect_success 'Try old id with slashy branch' '
+ ! stg id foo/ &&
+ ! stg id foo/top &&
+ ! stg id foo@x/y/z/top
+ '
test_expect_success 'Create patch in slashy branch' \
'echo "bar" >> foo.txt &&
mkdir -p .git/patches && touch .git/patches/foo
'
-test_expect_failure \
+test_expect_success \
'Try to create an stgit branch with a spurious patches/ entry' '
- stg branch -c foo
+ ! stg branch -c foo
'
test_expect_success \
cp .git/refs/heads/master .git/refs/heads/foo
'
-test_expect_failure \
+test_expect_success \
'Try to create an stgit branch with an existing git branch by that name' '
- stg branch -c foo
+ ! stg branch -c foo
'
test_expect_success \
stg new p1 -m "p1"
'
-test_expect_failure \
+test_expect_success \
'Rename the current stgit branch' \
- 'stg branch -r foo bar
+ '! stg branch -r foo bar
'
test_expect_success \
git commit -a -m bar
'
-test_expect_failure \
+test_expect_success \
'Try to create a patch in a GIT branch' \
'
- stg new p0 -m "p0"
+ ! stg new p0 -m "p0"
'
test_expect_success \
)
"
-test_expect_failure \
+test_expect_success \
'Attempt to push the first of those patches without --merged' \
- "(cd bar && stg push
+ "(cd bar && ! stg push
)
"
stg pop --all
'
-test_expect_failure \
+test_expect_success \
'Push the second patch with conflict' \
'
- stg push bar
+ ! stg push bar
'
test_expect_success \
test $(cat bar2.txt) = "bar2"
'
-test_expect_failure \
+test_expect_success \
'Synchronise the first two patches with the master branch (to fail)' \
'
- stg sync -B master -a
+ ! stg sync -B master -a
'
test_expect_success \
[ "$(echo $(stg unapplied))" = "" ]
'
-test_expect_failure \
+test_expect_success \
'Synchronise the third patch with the exported series (to fail)' \
'
- stg sync -s patches-master/series p3
+ ! stg sync -s patches-master/series p3
'
test_expect_success \
(cd clone && stg commit && stg new c2 -m c2 &&
echo a >> file && stg refresh)
'
-test_expect_failure \
+test_expect_success \
'Try to and commit a patch in clone' \
- '(cd clone && stg pull)'
+ '(cd clone && ! stg pull)'
test_done
stg branch stack && stg commit && stg new c2 -m c2 &&
echo a >> file && stg refresh
'
-test_expect_failure \
+test_expect_success \
'Try to pull/rebase now that stack base has moved' \
- 'stg pull'
+ '! stg pull'
test_expect_success \
'Force the pull/rebase, but do not push yet' \
'stg pull --force --nopush'
-test_expect_failure \
+test_expect_success \
'...check we lost the committed patch' \
- 'test -e file'
-test_expect_failure \
+ '! test -e file'
+test_expect_success \
'...and check we get a conflict while pushing' \
- 'stg push'
+ '! stg push'
test_done
test `stg applied | wc -l` = 1
'
-test_expect_failure \
+test_expect_success \
'Attempt rebase to non-existing commit' \
'
- stg rebase not-a-ref
+ ! stg rebase not-a-ref
'
test_expect_success \