##// END OF EJS Templates
test-command-template: improve test coverage
TK Soh -
r4353:5e857d72 default
parent child Browse files
Show More
@@ -1,113 +1,119
1 1 #!/bin/sh
2 2
3 3 hg init a
4 4 cd a
5 5 echo a > a
6 6 hg add a
7 7 echo line 1 > b
8 8 echo line 2 >> b
9 9 hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
10 10 hg add b
11 11 echo other 1 > c
12 12 echo other 2 >> c
13 13 echo >> c
14 14 echo other 3 >> c
15 15 hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
16 16 hg add c
17 17 hg commit -m 'no person' -d '1200000 0' -u 'other@place'
18 18 echo c >> c
19 19 hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
20 20 echo foo > .hg/branch
21 21 hg commit -m 'new branch' -d '1400000 0' -u 'person'
22 hg co -q 3
23 echo other 4 >> d
24 hg add d
25 hg commit -m 'new head' -d '1500000 0' -u 'person'
26 hg merge -q
27 hg commit -m 'merge' -d '1500001 0' -u 'person'
22 28
23 29 # make sure user/global hgrc does not affect tests
24 30 echo '[ui]' > .hg/hgrc
25 31 echo 'logtemplate =' >> .hg/hgrc
26 32 echo 'style =' >> .hg/hgrc
27 33
28 34 echo '# default style is like normal output'
29 35 echo '# normal'
30 36 hg log > log.out
31 37 hg log --style default > style.out
32 38 diff log.out style.out
33 39 echo '# verbose'
34 40 hg log -v > log.out
35 41 hg log -v --style default > style.out
36 42 diff log.out style.out
37 43 echo '# debug'
38 44 hg log --debug > log.out
39 45 hg log --debug --style default > style.out
40 46 diff log.out style.out
41 47
42 48 echo '# revision with no copies (used to print a traceback)'
43 49 hg tip -v --template '\n'
44 50
45 51 echo '# compact style works'
46 52 hg log --style compact
47 53 hg log -v --style compact
48 54 hg log --debug --style compact
49 55
50 56 echo '# error if style not readable'
51 57 touch q
52 58 chmod 0 q
53 59 hg log --style ./q
54 60
55 61 echo '# error if no style'
56 62 hg log --style notexist
57 63
58 64 echo '# error if style missing key'
59 65 echo 'q = q' > t
60 66 hg log --style ./t
61 67
62 68 echo '# error if include fails'
63 69 echo 'changeset = q' >> t
64 70 hg log --style ./t
65 71
66 72 echo '# include works'
67 73 rm q
68 74 echo '{rev}' > q
69 75 hg log --style ./t
70 76
71 77 echo '# ui.style works'
72 78 echo '[ui]' > .hg/hgrc
73 79 echo 'style = t' >> .hg/hgrc
74 80 hg log
75 81
76 82 echo '# issue338'
77 83 hg log --style=changelog > changelog
78 84 cat changelog
79 85
80 86 echo "# keys work"
81 87 for key in author branches date desc file_adds file_dels files \
82 88 manifest node parents rev tags; do
83 89 for mode in '' --verbose --debug; do
84 90 hg log $mode --template "$key$mode: {$key}\n"
85 91 done
86 92 done
87 93
88 94 echo '# filters work'
89 95 hg log --template '{author|domain}\n'
90 96 hg log --template '{author|person}\n'
91 97 hg log --template '{author|user}\n'
92 98 hg log --template '{date|age}\n' > /dev/null || exit 1
93 99 hg log --template '{date|date}\n'
94 100 hg log --template '{date|isodate}\n'
95 101 hg log --template '{date|rfc822date}\n'
96 102 hg log --template '{desc|firstline}\n'
97 103 hg log --template '{node|short}\n'
98 104
99 105 echo '# formatnode filter works'
100 106 echo '# quiet'
101 107 hg -q log -r 0 --template '#node|formatnode#\n'
102 108 echo '# normal'
103 109 hg log -r 0 --template '#node|formatnode#\n'
104 110 echo '# verbose'
105 111 hg -v log -r 0 --template '#node|formatnode#\n'
106 112 echo '# debug'
107 113 hg --debug log -r 0 --template '#node|formatnode#\n'
108 114
109 115 echo '# error on syntax'
110 116 echo 'x = "f' >> t
111 117 hg log
112 118
113 119 echo '# done'
@@ -1,350 +1,469
1 1 # default style is like normal output
2 2 # normal
3 3 # verbose
4 4 # debug
5 5 # revision with no copies (used to print a traceback)
6 6
7 7 # compact style works
8 4[tip] 32a18f097fcc 1970-01-17 04:53 +0000 person
8 6[tip]:5,4 c7b487c6c50e 1970-01-18 08:40 +0000 person
9 merge
10
11 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
12 new head
13
14 4 32a18f097fcc 1970-01-17 04:53 +0000 person
9 15 new branch
10 16
11 17 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
12 18 no user, no domain
13 19
14 20 2 97054abb4ab8 1970-01-14 21:20 +0000 other
15 21 no person
16 22
17 23 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
18 24 other 1
19 25
20 26 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
21 27 line 1
22 28
23 4[tip] 32a18f097fcc 1970-01-17 04:53 +0000 person
29 6[tip]:5,4 c7b487c6c50e 1970-01-18 08:40 +0000 person
30 merge
31
32 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
33 new head
34
35 4 32a18f097fcc 1970-01-17 04:53 +0000 person
24 36 new branch
25 37
26 38 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
27 39 no user, no domain
28 40
29 41 2 97054abb4ab8 1970-01-14 21:20 +0000 other
30 42 no person
31 43
32 44 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
33 45 other 1
34 46
35 47 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
36 48 line 1
37 49
38 4[tip]:3,-1 32a18f097fcc 1970-01-17 04:53 +0000 person
50 6[tip]:5,4 c7b487c6c50e 1970-01-18 08:40 +0000 person
51 merge
52
53 5:3,-1 13207e5a10d9 1970-01-18 08:40 +0000 person
54 new head
55
56 4:3,-1 32a18f097fcc 1970-01-17 04:53 +0000 person
39 57 new branch
40 58
41 59 3:2,-1 10e46f2dcbf4 1970-01-16 01:06 +0000 person
42 60 no user, no domain
43 61
44 62 2:1,-1 97054abb4ab8 1970-01-14 21:20 +0000 other
45 63 no person
46 64
47 65 1:0,-1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
48 66 other 1
49 67
50 68 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
51 69 line 1
52 70
53 71 # error if style not readable
54 72 abort: Permission denied: ./q
55 73 # error if no style
56 74 abort: No such file or directory: notexist
57 75 # error if style missing key
58 76 abort: ./t: no key named 'changeset'
59 77 # error if include fails
60 78 abort: template file ./q: Permission denied
61 79 # include works
80 6
81 5
62 82 4
63 83 3
64 84 2
65 85 1
66 86 0
67 87 # ui.style works
88 6
89 5
68 90 4
69 91 3
70 92 2
71 93 1
72 94 0
73 95 # issue338
96 1970-01-18 person <person>
97
98 * merge
99 [c7b487c6c50e] [tip]
100
101 * d:
102 new head
103 [13207e5a10d9]
104
74 105 1970-01-17 person <person>
75 106
76 107 * new branch
77 [32a18f097fcc] [tip]
108 [32a18f097fcc]
78 109
79 110 1970-01-16 person <person>
80 111
81 112 * c:
82 113 no user, no domain
83 114 [10e46f2dcbf4]
84 115
85 116 1970-01-14 other <other@place>
86 117
87 118 * c:
88 119 no person
89 120 [97054abb4ab8]
90 121
91 122 1970-01-13 A. N. Other <other@place>
92 123
93 124 * b:
94 125 other 1 other 2
95 126
96 127 other 3
97 128 [b608e9d1a3f0]
98 129
99 130 1970-01-12 User Name <user@hostname>
100 131
101 132 * a:
102 133 line 1 line 2
103 134 [1e4e1b8f71e0]
104 135
105 136 # keys work
106 137 author: person
107 138 author: person
139 author: person
140 author: person
108 141 author: other@place
109 142 author: A. N. Other <other@place>
110 143 author: User Name <user@hostname>
111 144 author--verbose: person
112 145 author--verbose: person
146 author--verbose: person
147 author--verbose: person
113 148 author--verbose: other@place
114 149 author--verbose: A. N. Other <other@place>
115 150 author--verbose: User Name <user@hostname>
116 151 author--debug: person
117 152 author--debug: person
153 author--debug: person
154 author--debug: person
118 155 author--debug: other@place
119 156 author--debug: A. N. Other <other@place>
120 157 author--debug: User Name <user@hostname>
158 branches:
159 branches:
121 160 branches: foo
122 161 branches:
123 162 branches:
124 163 branches:
125 164 branches:
165 branches--verbose:
166 branches--verbose:
126 167 branches--verbose: foo
127 168 branches--verbose:
128 169 branches--verbose:
129 170 branches--verbose:
130 171 branches--verbose:
172 branches--debug:
173 branches--debug:
131 174 branches--debug: foo
132 175 branches--debug:
133 176 branches--debug:
134 177 branches--debug:
135 178 branches--debug:
179 date: 1500001.00
180 date: 1500000.00
136 181 date: 1400000.00
137 182 date: 1300000.00
138 183 date: 1200000.00
139 184 date: 1100000.00
140 185 date: 1000000.00
186 date--verbose: 1500001.00
187 date--verbose: 1500000.00
141 188 date--verbose: 1400000.00
142 189 date--verbose: 1300000.00
143 190 date--verbose: 1200000.00
144 191 date--verbose: 1100000.00
145 192 date--verbose: 1000000.00
193 date--debug: 1500001.00
194 date--debug: 1500000.00
146 195 date--debug: 1400000.00
147 196 date--debug: 1300000.00
148 197 date--debug: 1200000.00
149 198 date--debug: 1100000.00
150 199 date--debug: 1000000.00
200 desc: merge
201 desc: new head
151 202 desc: new branch
152 203 desc: no user, no domain
153 204 desc: no person
154 205 desc: other 1
155 206 other 2
156 207
157 208 other 3
158 209 desc: line 1
159 210 line 2
211 desc--verbose: merge
212 desc--verbose: new head
160 213 desc--verbose: new branch
161 214 desc--verbose: no user, no domain
162 215 desc--verbose: no person
163 216 desc--verbose: other 1
164 217 other 2
165 218
166 219 other 3
167 220 desc--verbose: line 1
168 221 line 2
222 desc--debug: merge
223 desc--debug: new head
169 224 desc--debug: new branch
170 225 desc--debug: no user, no domain
171 226 desc--debug: no person
172 227 desc--debug: other 1
173 228 other 2
174 229
175 230 other 3
176 231 desc--debug: line 1
177 232 line 2
178 233 file_adds:
179 234 file_adds:
180 235 file_adds:
181 236 file_adds:
182 237 file_adds:
238 file_adds:
239 file_adds:
240 file_adds--verbose:
241 file_adds--verbose:
183 242 file_adds--verbose:
184 243 file_adds--verbose:
185 244 file_adds--verbose:
186 245 file_adds--verbose:
187 246 file_adds--verbose:
188 247 file_adds--debug:
248 file_adds--debug: d
249 file_adds--debug:
189 250 file_adds--debug:
190 251 file_adds--debug: c
191 252 file_adds--debug: b
192 253 file_adds--debug: a
193 254 file_dels:
194 255 file_dels:
195 256 file_dels:
196 257 file_dels:
197 258 file_dels:
259 file_dels:
260 file_dels:
198 261 file_dels--verbose:
199 262 file_dels--verbose:
200 263 file_dels--verbose:
201 264 file_dels--verbose:
202 265 file_dels--verbose:
266 file_dels--verbose:
267 file_dels--verbose:
268 file_dels--debug:
269 file_dels--debug:
203 270 file_dels--debug:
204 271 file_dels--debug:
205 272 file_dels--debug:
206 273 file_dels--debug:
207 274 file_dels--debug:
208 275 files:
276 files: d
277 files:
209 278 files: c
210 279 files: c
211 280 files: b
212 281 files: a
213 282 files--verbose:
283 files--verbose: d
284 files--verbose:
214 285 files--verbose: c
215 286 files--verbose: c
216 287 files--verbose: b
217 288 files--verbose: a
218 289 files--debug:
290 files--debug:
291 files--debug:
219 292 files--debug: c
220 293 files--debug:
221 294 files--debug:
222 295 files--debug:
223 296 manifest:
224 297 manifest:
225 298 manifest:
226 299 manifest:
227 300 manifest:
301 manifest:
302 manifest:
228 303 manifest--verbose:
229 304 manifest--verbose:
230 305 manifest--verbose:
231 306 manifest--verbose:
232 307 manifest--verbose:
308 manifest--verbose:
309 manifest--verbose:
310 manifest--debug: 6:91015e9dbdd76a6791085d12b0a0ec7fcd22ffbf
311 manifest--debug: 5:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
233 312 manifest--debug: 4:90ae8dda64e1a876c792bccb9af66284f6018363
234 313 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
235 314 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
236 315 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
237 316 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
317 node: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
318 node: 13207e5a10d9fd28ec424934298e176197f2c67f
238 319 node: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
239 320 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
240 321 node: 97054abb4ab824450e9164180baf491ae0078465
241 322 node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
242 323 node: 1e4e1b8f71e05681d422154f5421e385fec3454f
324 node--verbose: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
325 node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
243 326 node--verbose: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
244 327 node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
245 328 node--verbose: 97054abb4ab824450e9164180baf491ae0078465
246 329 node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
247 330 node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
331 node--debug: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
332 node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
248 333 node--debug: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
249 334 node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
250 335 node--debug: 97054abb4ab824450e9164180baf491ae0078465
251 336 node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
252 337 node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
338 parents: 5:13207e5a10d9 4:32a18f097fcc
339 parents: 3:10e46f2dcbf4
253 340 parents:
254 341 parents:
255 342 parents:
256 343 parents:
257 344 parents:
345 parents--verbose: 5:13207e5a10d9 4:32a18f097fcc
346 parents--verbose: 3:10e46f2dcbf4
258 347 parents--verbose:
259 348 parents--verbose:
260 349 parents--verbose:
261 350 parents--verbose:
262 351 parents--verbose:
352 parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:32a18f097fcccf76ef282f62f8a85b3adf8d13c4
353 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
263 354 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
264 355 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
265 356 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
266 357 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
267 358 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
359 rev: 6
360 rev: 5
268 361 rev: 4
269 362 rev: 3
270 363 rev: 2
271 364 rev: 1
272 365 rev: 0
366 rev--verbose: 6
367 rev--verbose: 5
273 368 rev--verbose: 4
274 369 rev--verbose: 3
275 370 rev--verbose: 2
276 371 rev--verbose: 1
277 372 rev--verbose: 0
373 rev--debug: 6
374 rev--debug: 5
278 375 rev--debug: 4
279 376 rev--debug: 3
280 377 rev--debug: 2
281 378 rev--debug: 1
282 379 rev--debug: 0
283 380 tags: tip
284 381 tags:
285 382 tags:
286 383 tags:
287 384 tags:
385 tags:
386 tags:
288 387 tags--verbose: tip
289 388 tags--verbose:
290 389 tags--verbose:
291 390 tags--verbose:
292 391 tags--verbose:
392 tags--verbose:
393 tags--verbose:
293 394 tags--debug: tip
294 395 tags--debug:
295 396 tags--debug:
296 397 tags--debug:
297 398 tags--debug:
399 tags--debug:
400 tags--debug:
298 401 # filters work
299 402
300 403
404
405
301 406 place
302 407 place
303 408 hostname
304 409 person
305 410 person
411 person
412 person
306 413 other
307 414 A. N. Other
308 415 User Name
309 416 person
310 417 person
418 person
419 person
311 420 other
312 421 other
313 422 user
423 Sun Jan 18 08:40:01 1970 +0000
424 Sun Jan 18 08:40:00 1970 +0000
314 425 Sat Jan 17 04:53:20 1970 +0000
315 426 Fri Jan 16 01:06:40 1970 +0000
316 427 Wed Jan 14 21:20:00 1970 +0000
317 428 Tue Jan 13 17:33:20 1970 +0000
318 429 Mon Jan 12 13:46:40 1970 +0000
430 1970-01-18 08:40 +0000
431 1970-01-18 08:40 +0000
319 432 1970-01-17 04:53 +0000
320 433 1970-01-16 01:06 +0000
321 434 1970-01-14 21:20 +0000
322 435 1970-01-13 17:33 +0000
323 436 1970-01-12 13:46 +0000
437 Sun, 18 Jan 1970 08:40:01 +0000
438 Sun, 18 Jan 1970 08:40:00 +0000
324 439 Sat, 17 Jan 1970 04:53:20 +0000
325 440 Fri, 16 Jan 1970 01:06:40 +0000
326 441 Wed, 14 Jan 1970 21:20:00 +0000
327 442 Tue, 13 Jan 1970 17:33:20 +0000
328 443 Mon, 12 Jan 1970 13:46:40 +0000
444 merge
445 new head
329 446 new branch
330 447 no user, no domain
331 448 no person
332 449 other 1
333 450 line 1
451 c7b487c6c50e
452 13207e5a10d9
334 453 32a18f097fcc
335 454 10e46f2dcbf4
336 455 97054abb4ab8
337 456 b608e9d1a3f0
338 457 1e4e1b8f71e0
339 458 # formatnode filter works
340 459 # quiet
341 460 1e4e1b8f71e0
342 461 # normal
343 462 1e4e1b8f71e0
344 463 # verbose
345 464 1e4e1b8f71e0
346 465 # debug
347 466 1e4e1b8f71e05681d422154f5421e385fec3454f
348 467 # error on syntax
349 468 abort: t:3: unmatched quotes
350 469 # done
General Comments 0
You need to be logged in to leave comments. Login now