changeset 15839:43317af36d28

tests: make {date|age} template output independent of the current date
author Steven Brown <StevenGBrown@gmail.com>
date Wed, 11 Jan 2012 22:18:20 +0800
parents 7299e09a85a2
children e7dde08254b7
files tests/test-command-template.t
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-command-template.t	Wed Jan 11 00:27:46 2012 +0100
+++ b/tests/test-command-template.t	Wed Jan 11 22:18:20 2012 +0800
@@ -1114,10 +1114,6 @@
   other
   user
 
-  $ hg log --template '{date|age}\n' > /dev/null || exit 1
-
-  $ hg log -l1 --template '{date|age}\n' 
-  7 years from now
   $ hg log --template '{date|date}\n'
   Wed Jan 01 10:01:00 2020 +0000
   Mon Jan 12 13:46:40 1970 +0000
@@ -1220,6 +1216,20 @@
   $ hg --debug log -r 0 --template '{node|formatnode}\n'
   1e4e1b8f71e05681d422154f5421e385fec3454f
 
+Age filter:
+
+  $ hg log --template '{date|age}\n' > /dev/null || exit 1
+
+  >>> from datetime import datetime
+  >>> fp = open('a', 'w')
+  >>> fp.write(str(datetime.now().year + 8) + '-01-01 00:00')
+  >>> fp.close()
+  $ hg add a
+  $ hg commit -m future -d "`cat a`"
+
+  $ hg log -l1 --template '{date|age}\n' 
+  7 years from now
+
 Error on syntax:
 
   $ echo 'x = "f' >> t