comparison tests/test-parse-date.t @ 12123:323292c2e566

tests: unify test-parse-date
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 30 Aug 2010 18:55:00 +0900
parents tests/test-parse-date@08a0f04b56bd
children 4134686b83e1
comparison
equal deleted inserted replaced
12122:9bab9ee901e8 12123:323292c2e566
1 This runs with TZ="GMT"
2
3 $ hg init
4 $ echo "test-parse-date" > a
5 $ hg add a
6 $ hg ci -d "2006-02-01 13:00:30" -m "rev 0"
7 $ echo "hi!" >> a
8 $ hg ci -d "2006-02-01 13:00:30 -0500" -m "rev 1"
9 $ hg tag -d "2006-04-15 13:30" "Hi"
10 $ hg backout --merge -d "2006-04-15 13:30 +0200" -m "rev 3" 1
11 reverting a
12 created new head
13 changeset 3:107ce1ee2b43 backs out changeset 1:25a1420a55f8
14 merging with changeset 3:107ce1ee2b43
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 (branch merge, don't forget to commit)
17 $ hg ci -d "1150000000 14400" -m "rev 4 (merge)"
18 $ echo "fail" >> a
19 $ hg ci -d "should fail" -m "fail"
20 abort: invalid date: 'should fail'
21 $ hg ci -d "100000000000000000 1400" -m "fail"
22 abort: date exceeds 32 bits: 100000000000000000
23 $ hg ci -d "100000 1400000" -m "fail"
24 abort: impossible time zone offset: 1400000
25
26 Check with local timezone other than GMT and with DST
27
28 $ TZ="PST+8PDT"
29 $ export TZ
30
31 PST=UTC-8 / PDT=UTC-7
32
33 $ hg debugrebuildstate
34 $ echo "a" > a
35 $ hg ci -d "2006-07-15 13:30" -m "summer@UTC-7"
36 $ hg debugrebuildstate
37 $ echo "b" > a
38 $ hg ci -d "2006-07-15 13:30 +0500" -m "summer@UTC+5"
39 $ hg debugrebuildstate
40 $ echo "c" > a
41 $ hg ci -d "2006-01-15 13:30" -m "winter@UTC-8"
42 $ hg debugrebuildstate
43 $ echo "d" > a
44 $ hg ci -d "2006-01-15 13:30 +0500" -m "winter@UTC+5"
45 $ hg log --template '{date|date}\n'
46 Sun Jan 15 13:30:00 2006 +0500
47 Sun Jan 15 13:30:00 2006 -0800
48 Sat Jul 15 13:30:00 2006 +0500
49 Sat Jul 15 13:30:00 2006 -0700
50 Sun Jun 11 00:26:40 2006 -0400
51 Sat Apr 15 13:30:00 2006 +0200
52 Sat Apr 15 13:30:00 2006 +0000
53 Wed Feb 01 13:00:30 2006 -0500
54 Wed Feb 01 13:00:30 2006 +0000
55
56 Test issue1014 (fractional timezones)
57
58 $ hg debugdate "1000000000 -16200" # 0430
59 internal: 1000000000 -16200
60 standard: Sun Sep 09 06:16:40 2001 +0430
61 $ hg debugdate "1000000000 -15300" # 0415
62 internal: 1000000000 -15300
63 standard: Sun Sep 09 06:01:40 2001 +0415
64 $ hg debugdate "1000000000 -14400" # 0400
65 internal: 1000000000 -14400
66 standard: Sun Sep 09 05:46:40 2001 +0400
67 $ hg debugdate "1000000000 0" # GMT
68 internal: 1000000000 0
69 standard: Sun Sep 09 01:46:40 2001 +0000
70 $ hg debugdate "1000000000 14400" # -0400
71 internal: 1000000000 14400
72 standard: Sat Sep 08 21:46:40 2001 -0400
73 $ hg debugdate "1000000000 15300" # -0415
74 internal: 1000000000 15300
75 standard: Sat Sep 08 21:31:40 2001 -0415
76 $ hg debugdate "1000000000 16200" # -0430
77 internal: 1000000000 16200
78 standard: Sat Sep 08 21:16:40 2001 -0430
79 $ hg debugdate "Sat Sep 08 21:16:40 2001 +0430"
80 internal: 999967600 -16200
81 standard: Sat Sep 08 21:16:40 2001 +0430
82 $ hg debugdate "Sat Sep 08 21:16:40 2001 -0430"
83 internal: 1000000000 16200
84 standard: Sat Sep 08 21:16:40 2001 -0430
85
86 Test 12-hours times
87
88 $ hg debugdate "2006-02-01 1:00:30PM +0000"
89 internal: 1138798830 0
90 standard: Wed Feb 01 13:00:30 2006 +0000
91 $ hg debugdate "1:00:30PM" > /dev/null || echo 'failed'
92
93 Test date formats with '>' or '<' accompanied by space characters
94
95 $ hg log -d '>' --template '{date|date}\n'
96 Sun Jan 15 13:30:00 2006 +0500
97 Sun Jan 15 13:30:00 2006 -0800
98 Sat Jul 15 13:30:00 2006 +0500
99 Sat Jul 15 13:30:00 2006 -0700
100 Sun Jun 11 00:26:40 2006 -0400
101 Sat Apr 15 13:30:00 2006 +0200
102 Sat Apr 15 13:30:00 2006 +0000
103 Wed Feb 01 13:00:30 2006 -0500
104 Wed Feb 01 13:00:30 2006 +0000
105 $ hg log -d '<' hg log -d '>' --template '{date|date}\n'
106
107 $ hg log -d ' >' --template '{date|date}\n'
108 Sun Jan 15 13:30:00 2006 +0500
109 Sun Jan 15 13:30:00 2006 -0800
110 Sat Jul 15 13:30:00 2006 +0500
111 Sat Jul 15 13:30:00 2006 -0700
112 Sun Jun 11 00:26:40 2006 -0400
113 Sat Apr 15 13:30:00 2006 +0200
114 Sat Apr 15 13:30:00 2006 +0000
115 Wed Feb 01 13:00:30 2006 -0500
116 Wed Feb 01 13:00:30 2006 +0000
117 $ hg log -d ' <' --template '{date|date}\n'
118
119 $ hg log -d '> ' --template '{date|date}\n'
120 Sun Jan 15 13:30:00 2006 +0500
121 Sun Jan 15 13:30:00 2006 -0800
122 Sat Jul 15 13:30:00 2006 +0500
123 Sat Jul 15 13:30:00 2006 -0700
124 Sun Jun 11 00:26:40 2006 -0400
125 Sat Apr 15 13:30:00 2006 +0200
126 Sat Apr 15 13:30:00 2006 +0000
127 Wed Feb 01 13:00:30 2006 -0500
128 Wed Feb 01 13:00:30 2006 +0000
129 $ hg log -d '< ' --template '{date|date}\n'
130
131 $ hg log -d ' > ' --template '{date|date}\n'
132 Sun Jan 15 13:30:00 2006 +0500
133 Sun Jan 15 13:30:00 2006 -0800
134 Sat Jul 15 13:30:00 2006 +0500
135 Sat Jul 15 13:30:00 2006 -0700
136 Sun Jun 11 00:26:40 2006 -0400
137 Sat Apr 15 13:30:00 2006 +0200
138 Sat Apr 15 13:30:00 2006 +0000
139 Wed Feb 01 13:00:30 2006 -0500
140 Wed Feb 01 13:00:30 2006 +0000
141 $ hg log -d ' < ' --template '{date|date}\n'
142
143 $ hg log -d '>02/01' --template '{date|date}\n'
144 $ hg log -d '<02/01' --template '{date|date}\n'
145 Sun Jan 15 13:30:00 2006 +0500
146 Sun Jan 15 13:30:00 2006 -0800
147 Sat Jul 15 13:30:00 2006 +0500
148 Sat Jul 15 13:30:00 2006 -0700
149 Sun Jun 11 00:26:40 2006 -0400
150 Sat Apr 15 13:30:00 2006 +0200
151 Sat Apr 15 13:30:00 2006 +0000
152 Wed Feb 01 13:00:30 2006 -0500
153 Wed Feb 01 13:00:30 2006 +0000
154
155 $ hg log -d ' >02/01' --template '{date|date}\n'
156 $ hg log -d ' <02/01' --template '{date|date}\n'
157 Sun Jan 15 13:30:00 2006 +0500
158 Sun Jan 15 13:30:00 2006 -0800
159 Sat Jul 15 13:30:00 2006 +0500
160 Sat Jul 15 13:30:00 2006 -0700
161 Sun Jun 11 00:26:40 2006 -0400
162 Sat Apr 15 13:30:00 2006 +0200
163 Sat Apr 15 13:30:00 2006 +0000
164 Wed Feb 01 13:00:30 2006 -0500
165 Wed Feb 01 13:00:30 2006 +0000
166
167 $ hg log -d '> 02/01' --template '{date|date}\n'
168 $ hg log -d '< 02/01' --template '{date|date}\n'
169 Sun Jan 15 13:30:00 2006 +0500
170 Sun Jan 15 13:30:00 2006 -0800
171 Sat Jul 15 13:30:00 2006 +0500
172 Sat Jul 15 13:30:00 2006 -0700
173 Sun Jun 11 00:26:40 2006 -0400
174 Sat Apr 15 13:30:00 2006 +0200
175 Sat Apr 15 13:30:00 2006 +0000
176 Wed Feb 01 13:00:30 2006 -0500
177 Wed Feb 01 13:00:30 2006 +0000
178
179 $ hg log -d ' > 02/01' --template '{date|date}\n'
180 $ hg log -d ' < 02/01' --template '{date|date}\n'
181 Sun Jan 15 13:30:00 2006 +0500
182 Sun Jan 15 13:30:00 2006 -0800
183 Sat Jul 15 13:30:00 2006 +0500
184 Sat Jul 15 13:30:00 2006 -0700
185 Sun Jun 11 00:26:40 2006 -0400
186 Sat Apr 15 13:30:00 2006 +0200
187 Sat Apr 15 13:30:00 2006 +0000
188 Wed Feb 01 13:00:30 2006 -0500
189 Wed Feb 01 13:00:30 2006 +0000
190
191 $ hg log -d '>02/01 ' --template '{date|date}\n'
192 $ hg log -d '<02/01 ' --template '{date|date}\n'
193 Sun Jan 15 13:30:00 2006 +0500
194 Sun Jan 15 13:30:00 2006 -0800
195 Sat Jul 15 13:30:00 2006 +0500
196 Sat Jul 15 13:30:00 2006 -0700
197 Sun Jun 11 00:26:40 2006 -0400
198 Sat Apr 15 13:30:00 2006 +0200
199 Sat Apr 15 13:30:00 2006 +0000
200 Wed Feb 01 13:00:30 2006 -0500
201 Wed Feb 01 13:00:30 2006 +0000
202
203 $ hg log -d ' >02/01 ' --template '{date|date}\n'
204 $ hg log -d ' <02/01 ' --template '{date|date}\n'
205 Sun Jan 15 13:30:00 2006 +0500
206 Sun Jan 15 13:30:00 2006 -0800
207 Sat Jul 15 13:30:00 2006 +0500
208 Sat Jul 15 13:30:00 2006 -0700
209 Sun Jun 11 00:26:40 2006 -0400
210 Sat Apr 15 13:30:00 2006 +0200
211 Sat Apr 15 13:30:00 2006 +0000
212 Wed Feb 01 13:00:30 2006 -0500
213 Wed Feb 01 13:00:30 2006 +0000
214
215 $ hg log -d '> 02/01 ' --template '{date|date}\n'
216 $ hg log -d '< 02/01 ' --template '{date|date}\n'
217 Sun Jan 15 13:30:00 2006 +0500
218 Sun Jan 15 13:30:00 2006 -0800
219 Sat Jul 15 13:30:00 2006 +0500
220 Sat Jul 15 13:30:00 2006 -0700
221 Sun Jun 11 00:26:40 2006 -0400
222 Sat Apr 15 13:30:00 2006 +0200
223 Sat Apr 15 13:30:00 2006 +0000
224 Wed Feb 01 13:00:30 2006 -0500
225 Wed Feb 01 13:00:30 2006 +0000
226
227 $ hg log -d ' > 02/01 ' --template '{date|date}\n'
228 $ hg log -d ' < 02/01 ' --template '{date|date}\n'
229 Sun Jan 15 13:30:00 2006 +0500
230 Sun Jan 15 13:30:00 2006 -0800
231 Sat Jul 15 13:30:00 2006 +0500
232 Sat Jul 15 13:30:00 2006 -0700
233 Sun Jun 11 00:26:40 2006 -0400
234 Sat Apr 15 13:30:00 2006 +0200
235 Sat Apr 15 13:30:00 2006 +0000
236 Wed Feb 01 13:00:30 2006 -0500
237 Wed Feb 01 13:00:30 2006 +0000