summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2020-02-23 10:14:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-24 19:34:21 (GMT)
commitdf126ca14269efaf4d28453743a386be81ebec85 (patch)
treeb6ac00fb383cb4110a7442a3f17538896e9453fe /t
parentd0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783 (diff)
downloadgit-df126ca14269efaf4d28453743a386be81ebec85.zip
git-df126ca14269efaf4d28453743a386be81ebec85.tar.gz
git-df126ca14269efaf4d28453743a386be81ebec85.tar.bz2
t3400: make test clean up after itself
This test intentionally creates a file which causes rebase to fail, thus it is important that this file be deleted before subsequent tests are run which are not expecting such a failure. In the past, the common way to ensure cleanup (regardless of whether the test succeeded or failed) was either for the next test to perform the previous test's cleanup as its first step or to do the cleanup at global scope outside of any tests. With the introduction of 'test_when_finished', however, tests can be responsible for their own cleanup. Therefore, update this test to clean up after itself. A bit of history: This 'rm' invocation was moved from within the body of the following test to global scope by bffd750adf (rebase: improve error message when upstream argument is missing, 2010-05-31), which postdates, by about a month, introduction of 'test_when_finished' in 3bf7886705 (test-lib: Let tests specify commands to be run at end of test, 2010-05-02). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3400-rebase.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 221b35f..6e746dc 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -143,11 +143,11 @@ test_expect_success 'setup: recover' '
test_expect_success 'Show verbose error when HEAD could not be detached' '
>B &&
+ test_when_finished "rm -f B" &&
test_must_fail git rebase topic 2>output.err >output.out &&
test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" output.err &&
test_i18ngrep B output.err
'
-rm -f B
test_expect_success 'fail when upstream arg is missing and not on branch' '
git checkout topic &&