comparison tests/test-command-template.t @ 37229:05db42732fce

templatefilters: handle TypeError by count() Prepares for removing the weird exception catcher from runfilter().
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Mar 2018 16:47:44 +0900
parents 9bcf096a2da2
children 7c902a8345ef
comparison
equal deleted inserted replaced
37228:a0b17f744cbc 37229:05db42732fce
2275 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2 2275 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2
2276 | 2276 |
2277 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1 2277 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1
2278 2278
2279 2279
2280 $ hg log -l1 -T '{termwidth|count}\n'
2281 hg: parse error: not countable
2282 (template filter 'count' is not compatible with keyword 'termwidth')
2283 [255]
2284
2280 Upper/lower filters: 2285 Upper/lower filters:
2281 2286
2282 $ hg log -r0 --template '{branch|upper}\n' 2287 $ hg log -r0 --template '{branch|upper}\n'
2283 DEFAULT 2288 DEFAULT
2284 $ hg log -r0 --template '{author|lower}\n' 2289 $ hg log -r0 --template '{author|lower}\n'
3264 $ cd .. 3269 $ cd ..
3265 3270
3266 Test laziness of if() then/else clause 3271 Test laziness of if() then/else clause
3267 3272
3268 $ hg debugtemplate '{count(0)}' 3273 $ hg debugtemplate '{count(0)}'
3269 abort: incompatible use of template filter 'count' 3274 hg: parse error: not countable
3275 (incompatible use of template filter 'count')
3270 [255] 3276 [255]
3271 $ hg debugtemplate '{if(true, "", count(0))}' 3277 $ hg debugtemplate '{if(true, "", count(0))}'
3272 $ hg debugtemplate '{if(false, count(0), "")}' 3278 $ hg debugtemplate '{if(false, count(0), "")}'
3273 $ hg debugtemplate '{ifcontains("a", "aa", "", count(0))}' 3279 $ hg debugtemplate '{ifcontains("a", "aa", "", count(0))}'
3274 $ hg debugtemplate '{ifcontains("a", "bb", count(0), "")}' 3280 $ hg debugtemplate '{ifcontains("a", "bb", count(0), "")}'