[PATCH/RFC 6/6] test: add simple sorted tag test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Marc-Andre Lureau <marcandre.lureau@xxxxxxxxx>
---
 t/t7004-tag.sh |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 69501e2..b8c07f5 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -174,6 +174,8 @@ test_expect_success 'listing all tags should print
them ordered' '
 	git tag t210 &&
 	git tag -l > actual &&
 	test_cmp expect actual &&
+	git tag -l -D > actual &&
+	test_cmp expect actual &&
 	git tag > actual &&
 	test_cmp expect actual
 '
@@ -579,6 +581,57 @@ test_expect_success \
 	test_cmp expect actual
 '

+# listing various tags sorted by date:
+test_tick
+
+time=$test_tick
+get_tag_header dated-tag-Z $commit commit $time >expect
+echo "A dated message +0" >>expect
+test_expect_success \
+	'creating an annotated tag with -m message should succeed' '
+	git tag -m "A dated message +0" dated-tag-Z &&
+	get_tag_msg dated-tag-Z >actual &&
+	test_cmp expect actual
+'
+
+time=$(($test_tick + 30000))
+GIT_COMMITTER_DATE="$time -0700"
+GIT_AUTHOR_DATE="$time -0700"
+export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
+
+get_tag_header dated-tag-W $commit commit $time >expect
+echo "A dated message +3" >>expect
+test_expect_success \
+	'creating an annotated tag with -m message should succeed' '
+	git tag -m "A dated message +3" dated-tag-W &&
+	get_tag_msg dated-tag-W >actual &&
+	test_cmp expect actual
+'
+
+time=$(($test_tick + 10000))
+GIT_COMMITTER_DATE="$time -0700"
+GIT_AUTHOR_DATE="$time -0700"
+export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
+
+get_tag_header dated-tag-Y $commit commit $time >expect
+echo "A dated message +1" >>expect
+test_expect_success \
+	'creating an annotated tag with -m message should succeed' '
+	git tag -m "A dated message +1" dated-tag-Y &&
+	get_tag_msg dated-tag-Y >actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<EOF
+dated-tag-Z
+dated-tag-Y
+dated-tag-W
+EOF
+test_expect_success 'listing annotated tags by date' '
+	git tag -l -D "*dated*" > actual &&
+	test_cmp expect actual
+'
+
 # subsequent tests require gpg; check if it is available
 gpg --version >/dev/null
 if [ $? -eq 127 ]; then
-- 
1.6.2.rc1.28.g05ef4.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux