[PATCH 4/4] git-mktag tests: Expand on mktag selftests according to the new tag object structure
Some more tests are added to test the new "keywords" header.
Signed-off-by: Johan Herland <johan@herland.net>
---
t/t3800-mktag.sh | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 152 insertions(+), 4 deletions(-)
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index ca90662..cc2f246 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -174,7 +174,95 @@ EOF
check_verify_failure 'verify tag-name check'
############################################################
-# 11. tagger line label check #1
+# 11. keywords line label check #1
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+xxxxxxxx foo
+EOF
+
+cat >expect.pat <<EOF
+^error: char70: could not find "tagger"$
+EOF
+
+check_verify_failure '"keywords" line label check #1'
+
+############################################################
+# 12. keywords line label check #2
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+keywords
+tagger bar@baz.com
+
+EOF
+
+cat >expect.pat <<EOF
+^error: char70: could not find "tagger"$
+EOF
+
+check_verify_failure '"keywords" line label check #2'
+
+############################################################
+# 13. keywords line check #1
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+keywords foo bar baz
+tagger bar@baz.com
+
+EOF
+
+cat >expect.pat <<EOF
+^error: char83: could not verify keywords$
+EOF
+
+check_verify_failure '"keywords" line check #1'
+
+############################################################
+# 14. keywords line check #2
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+keywords foo,bar baz
+tagger bar@baz.com
+
+EOF
+
+cat >expect.pat <<EOF
+^error: char87: could not verify keywords$
+EOF
+
+check_verify_failure '"keywords" line check #2'
+
+############################################################
+# 15. keywords line check #3
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+keywords foo,,bar
+tagger bar@baz.com
+
+EOF
+
+cat >expect.pat <<EOF
+^error: char83: could not verify keywords$
+EOF
+
+check_verify_failure '"keywords" line check #3'
+
+############################################################
+# 16. tagger line label check #1
cat >tag.sig <<EOF
object $head
@@ -189,7 +277,7 @@ EOF
check_verify_failure '"tagger" line label check #1'
############################################################
-# 12. tagger line label check #2
+# 17. tagger line label check #2
cat >tag.sig <<EOF
object $head
@@ -205,7 +293,7 @@ EOF
check_verify_failure '"tagger" line label check #2'
############################################################
-# 13. create valid tag
+# 18. create valid tag #1
cat >tag.sig <<EOF
object $head
@@ -219,11 +307,71 @@ test_expect_success \
'git-mktag <tag.sig >.git/refs/tags/mytag 2>message'
############################################################
-# 14. check mytag
+# 19. check mytag
test_expect_success \
'check mytag' \
'git-tag -l | grep mytag'
+############################################################
+# 20. create valid tag #2
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tagger another@example.com
+
+EOF
+
+test_expect_success \
+ 'create valid tag #2' \
+ 'git-mktag <tag.sig >.git/refs/tags/mytag 2>message'
+
+############################################################
+# 21. create valid tag #3
+
+cat >tag.sig <<EOF
+object $head
+type commit
+keywords foo,bar,baz,spam,spam,spam,spam,spam,spam,spam,spam
+tagger another@example.com
+
+EOF
+
+test_expect_success \
+ 'create valid tag #3' \
+ 'git-mktag <tag.sig >.git/refs/tags/mytag 2>message'
+
+############################################################
+# 22. create valid tag #4
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+keywords note
+tagger another@example.com
+
+EOF
+
+test_expect_success \
+ 'create valid tag #4' \
+ 'git-mktag <tag.sig >.git/refs/tags/mytag 2>message'
+
+############################################################
+# 23. create valid tag #5 (with empty message)
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+keywords note
+tagger a
+EOF
+
+test_expect_success \
+ 'create valid tag #4' \
+ 'git-mktag <tag.sig >.git/refs/tags/mytag 2>message'
+
test_done
--
1.5.2.1.144.gabc40