git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC 6/6] test: add simple sorted tag test
@ 2009-02-22 18:06 Marc-André Lureau
  0 siblings, 0 replies; only message in thread
From: Marc-André Lureau @ 2009-02-22 18:06 UTC (permalink / raw)
  To: git

Signed-off-by: Marc-Andre Lureau <marcandre.lureau@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-22 18:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-22 18:06 [PATCH/RFC 6/6] test: add simple sorted tag test Marc-André Lureau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).