t7004-tag.sh: re-arrange git tag comment for clarity
Split the "message in editor has initial comment" test into three tests. The motivation is to be able to only skip the middle part under NO_GETTEXT_POISON. In addition the return value of 'git tag' was being returned. We now check that it's non-zero. I used ! instead of test_must_fail so that the GIT_EDITOR variable was only used in this command invocation, and because the surrounding tests use this style. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Nov 14, 2010 at 14:44 UTC
5649bd9a5174c5dbd1933b26275f7c7f50fd9224
1 file changed
+15
-5
t/t7004-tag.sh
+15
-5
@@ -1051,13 +1051,23 @@ test_expect_success \
1051
1052
test_expect_success \
1053
'message in editor has initial comment' '
1054
- GIT_EDITOR=cat git tag -a initial-comment > actual
1054
+ ! (GIT_EDITOR=cat git tag -a initial-comment > actual)
1055
+'
1056
+
1057
+test_expect_success \
1058
+ 'message in editor has initial comment: first line' '
1059
# check the first line --- should be empty
1056
- first=$(sed -e 1q <actual) &&
1057
- test -z "$first" &&
1060
+ echo >first.expect &&
1061
+ sed -e 1q <actual >first.actual &&
1062
+ test_cmp first.expect first.actual
1063
+'
1064
+
1065
+test_expect_success \
1066
+ 'message in editor has initial comment: remainder' '
1067
# remove commented lines from the remainder -- should be empty
1059
- rest=$(sed -e 1d -e '/^#/d' <actual) &&
1060
- test -z "$rest"
1068
+ >rest.expect
1069
+ sed -e 1d -e '/^#/d' <actual >rest.actual &&
1070
+ test_cmp rest.expect rest.actual
1071
'
1072
1073
get_tag_header reuse $commit commit $time >expect