git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: git@vger.kernel.org
Cc: Chris Packham <judge.packham@gmail.com>
Subject: [PATCH] Add test for ambiguous patch dates
Date: Wed, 12 Sep 2012 21:35:51 +1200	[thread overview]
Message-ID: <1347442551-7105-2-git-send-email-judge.packham@gmail.com> (raw)
In-Reply-To: <1347442551-7105-1-git-send-email-judge.packham@gmail.com>

--
This testcase is only good for the next couple of months. For a longer term
test the current time would need to be set in the test setup.

---
 t/t4255-am-author-date.sh |   85 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100755 t/t4255-am-author-date.sh

diff --git a/t/t4255-am-author-date.sh b/t/t4255-am-author-date.sh
new file mode 100755
index 0000000..62bceee
--- /dev/null
+++ b/t/t4255-am-author-date.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+test_description='git am with ambiguous date'
+. ./test-lib.sh
+
+cat >patch.diff <<EOF
+From:   A U Thor <au.thor@example.com>
+To:     C O Mmitter <co.mmitter@example.com>
+Date:   12/9/2012 12:00 AM
+Subject:       [PATCH] add file.txt
+---
+ file.txt |    7 +++++++
+ 1 file changed, 7 insertions(+)
+ create mode 100644 file.txt
+
+diff --git a/file.txt b/file.txt
+new file mode 100644
+index 0000000..fe745d6
+--- /dev/null
++++ b/file.txt
+@@ -0,0 +1,7 @@
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam pulvinar
++tempus ligula vitae ornare. Vestibulum ante ipsum primis in faucibus orci
++luctus et ultrices posuere cubilia Curae; Aenean dapibus mauris non quam
++commodo a porta sapien suscipit. Mauris venenatis, dui nec malesuada mattis,
++ante mauris ornare ipsum, ac tincidunt ipsum lectus aliquet tortor. Nulla ipsum
++felis, egestas at condimentum quis, accumsan nec arcu. Phasellus fringilla
++viverra tempus. Integer vel rhoncus odio.
+EOF
+
+test_expect_success 'apply patch with ambiguous date' '
+	git am patch.diff
+'
+
+cat >expected <<EOF
+Date:   Wed Sep 12 00:00:00 2012 +0000
+EOF
+
+test_expect_failure 'check ambiguous date' '
+	git show HEAD | grep Date >actual &&
+	test_cmp expected actual
+'
+
+cat >patch.diff <<EOF
+From:   A N Other <an.other@example.com>
+To:     C O Mmitter <co.mmitter@example.com>
+Date:   12.9.2012 12:00 AM
+Subject:       [PATCH] update file.txt
+---
+ file.txt |    9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/file.txt b/file.txt
+index fe745d6..cd45361 100644
+--- a/file.txt
++++ b/file.txt
+@@ -5,3 +5,12 @@ commodo a porta sapien suscipit. Mauris venenatis, dui nec malesuada mattis,
+ ante mauris ornare ipsum, ac tincidunt ipsum lectus aliquet tortor. Nulla ipsum
+ felis, egestas at condimentum quis, accumsan nec arcu. Phasellus fringilla
+ viverra tempus. Integer vel rhoncus odio.
++
++Donec et ante eu mi aliquam sodales non ut massa. Nullam a luctus dui. Etiam ac
++eros elit. Pellentesque habitant morbi tristique senectus et netus et malesuada
++fames ac turpis egestas. Curabitur commodo ligula id leo iaculis vel lobortis
++leo pulvinar. Aenean adipiscing cursus arcu quis consectetur. Morbi eget lectus
++nec neque interdum lacinia. Nam quis metus eget ligula faucibus imperdiet in et
++ligula. Aenean eu urna sit amet metus sagittis interdum non cursus orci.
++Maecenas imperdiet feugiat tellus, non ultrices nulla dictum sed. Nulla vel
++lorem ac massa euismod faucibus et ut leo.
+EOF
+
+test_expect_success 'apply patch with european date separator' '
+	git am patch.diff
+'
+
+cat >expected <<EOF
+Date:   Wed Sep 12 00:00:00 2012 +0000
+EOF
+
+test_expect_success 'check european date' '
+	git show HEAD | grep Date >actual &&
+	test_cmp expected actual
+'
+
+test_done
-- 
1.7.10.4

  reply	other threads:[~2012-09-12  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12  9:35 Ambiguous date handling Chris Packham
2012-09-12  9:35 ` Chris Packham [this message]
2012-09-12  9:48 ` Junio C Hamano
2012-09-12 10:09   ` Chris Packham
2012-09-12 16:58     ` Junio C Hamano

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=1347442551-7105-2-git-send-email-judge.packham@gmail.com \
    --to=judge.packham@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).