git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Marc-André Lureau <marcandre.lureau@gmail.com>
Date
Feb 22, 2009, 18:06 UTC
Message-ID
<e29894ca0902221006k5743e19eqb18cf7b1eec84706@mail.gmail.com>
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
Message 1 of 1 in “test: add simple sorted tag test”
  1. 6/6 test: add simple sorted tag testMarc-André Lureau, Feb 22, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.