[PATCH] Add test for ambiguous patch dates

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

 



--
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@xxxxxxxxxxx>
+To:     C O Mmitter <co.mmitter@xxxxxxxxxxx>
+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@xxxxxxxxxxx>
+To:     C O Mmitter <co.mmitter@xxxxxxxxxxx>
+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

--
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]