git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH/RFC 6/6] test: add simple sorted tag test
Date: Sun, 22 Feb 2009 20:06:41 +0200	[thread overview]
Message-ID: <e29894ca0902221006k5743e19eqb18cf7b1eec84706@mail.gmail.com> (raw)

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

                 reply	other threads:[~2009-02-22 18:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e29894ca0902221006k5743e19eqb18cf7b1eec84706@mail.gmail.com \
    --to=marcandre.lureau@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).