t7004-tag: delete unnecessary tags with test_when_finished
authorSZEDER Gábor <szeder.dev@gmail.com>
Thu, 8 Dec 2016 14:23:55 +0000 (15:23 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Dec 2016 19:11:57 +0000 (11:11 -0800)
The '--force is moot with a non-existing tag name' test creates two
new tags, which are then deleted right after the test is finished,
outside the test_expect_success block, allowing 'git tag -d's output to
pollute the test output.

Use test_when_finished to delete those tags.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7004-tag.sh
index 8b0f71a2ac15d65f977b0daa2a53ad47b64a043a..396cffeeb5adeee3ce54c6dd94902810c67c5236 100755 (executable)
@@ -122,11 +122,11 @@ test_expect_success '--force can create a tag with the name of one existing' '
        tag_exists mytag'
 
 test_expect_success '--force is moot with a non-existing tag name' '
+       test_when_finished git tag -d newtag forcetag &&
        git tag newtag >expect &&
        git tag --force forcetag >actual &&
        test_cmp expect actual
 '
-git tag -d newtag forcetag
 
 # deleting tags: