Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
t6300: add tests for "-local" date formats
author
John Keeping
<john@keeping.me.uk>
Thu, 3 Sep 2015 21:49:01 +0000
(22:49 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 3 Sep 2015 22:46:55 +0000
(15:46 -0700)
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6300-for-each-ref.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
db7bae2
)
diff --git
a/t/t6300-for-each-ref.sh
b/t/t6300-for-each-ref.sh
index 4867df4796b6d71bb8c499e0184519fecebb085f..d6c9e627acd9d7ee997790ef71bd5aa7db53c90f 100755
(executable)
--- a/
t/t6300-for-each-ref.sh
+++ b/
t/t6300-for-each-ref.sh
@@
-180,6
+180,10
@@
test_expect_success 'Check format "default" formatted date fields output' '
"Tue Jul 4 01:18:45 2006 +0200"
'
"Tue Jul 4 01:18:45 2006 +0200"
'
+test_expect_success 'Check format "default-local" date fields output' '
+ test_date default-local "Mon Jul 3 23:18:43 2006" "Mon Jul 3 23:18:44 2006" "Mon Jul 3 23:18:45 2006"
+'
+
# Don't know how to do relative check because I can't know when this script
# is going to be run and can't fake the current time to git, and hence can't
# provide expected output. Instead, I'll just make sure that "relative"
# Don't know how to do relative check because I can't know when this script
# is going to be run and can't fake the current time to git, and hence can't
# provide expected output. Instead, I'll just make sure that "relative"
@@
-190,10
+194,22
@@
test_expect_success 'Check format "relative" date fields output' '
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual
'
git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual
'
+# We just check that this is the same as "relative" for now.
+test_expect_success 'Check format "relative-local" date fields output' '
+ test_date relative-local \
+ "$(git for-each-ref --format="%(committerdate:relative)" refs/heads)" \
+ "$(git for-each-ref --format="%(authordate:relative)" refs/heads)" \
+ "$(git for-each-ref --format="%(taggerdate:relative)" refs/tags)"
+'
+
test_expect_success 'Check format "short" date fields output' '
test_date short 2006-07-04 2006-07-04 2006-07-04
'
test_expect_success 'Check format "short" date fields output' '
test_date short 2006-07-04 2006-07-04 2006-07-04
'
+test_expect_success 'Check format "short-local" date fields output' '
+ test_date short-local 2006-07-03 2006-07-03 2006-07-03
+'
+
test_expect_success 'Check format "local" date fields output' '
test_date local \
"Mon Jul 3 23:18:43 2006" \
test_expect_success 'Check format "local" date fields output' '
test_date local \
"Mon Jul 3 23:18:43 2006" \
@@
-208,6
+224,10
@@
test_expect_success 'Check format "iso8601" date fields output' '
"2006-07-04 01:18:45 +0200"
'
"2006-07-04 01:18:45 +0200"
'
+test_expect_success 'Check format "iso8601-local" date fields output' '
+ test_date iso8601-local "2006-07-03 23:18:43 +0000" "2006-07-03 23:18:44 +0000" "2006-07-03 23:18:45 +0000"
+'
+
test_expect_success 'Check format "rfc2822" date fields output' '
test_date rfc2822 \
"Tue, 4 Jul 2006 01:18:43 +0200" \
test_expect_success 'Check format "rfc2822" date fields output' '
test_date rfc2822 \
"Tue, 4 Jul 2006 01:18:43 +0200" \
@@
-215,10
+235,18
@@
test_expect_success 'Check format "rfc2822" date fields output' '
"Tue, 4 Jul 2006 01:18:45 +0200"
'
"Tue, 4 Jul 2006 01:18:45 +0200"
'
+test_expect_success 'Check format "rfc2822-local" date fields output' '
+ test_date rfc2822-local "Mon, 3 Jul 2006 23:18:43 +0000" "Mon, 3 Jul 2006 23:18:44 +0000" "Mon, 3 Jul 2006 23:18:45 +0000"
+'
+
test_expect_success 'Check format "raw" date fields output' '
test_date raw "1151968723 +0200" "1151968724 +0200" "1151968725 +0200"
'
test_expect_success 'Check format "raw" date fields output' '
test_date raw "1151968723 +0200" "1151968724 +0200" "1151968725 +0200"
'
+test_expect_success 'Check format "raw-local" date fields output' '
+ test_date raw-local "1151968723 +0000" "1151968724 +0000" "1151968725 +0000"
+'
+
test_expect_success 'Check format of strftime date fields' '
echo "my date is 2006-07-04" >expected &&
git for-each-ref \
test_expect_success 'Check format of strftime date fields' '
echo "my date is 2006-07-04" >expected &&
git for-each-ref \
@@
-227,6
+255,14
@@
test_expect_success 'Check format of strftime date fields' '
test_cmp expected actual
'
test_cmp expected actual
'
+test_expect_success 'Check format of strftime-local date fields' '
+ echo "my date is 2006-07-03" >expected &&
+ git for-each-ref \
+ --format="%(authordate:format-local:my date is %Y-%m-%d)" \
+ refs/heads >actual &&
+ test_cmp expected actual
+'
+
cat >expected <<\EOF
refs/heads/master
refs/remotes/origin/master
cat >expected <<\EOF
refs/heads/master
refs/remotes/origin/master