diff tests/test-command-template.t @ 37499:75c13343cf38

templater: wrap result of '%' operation so it never looks like a thunk This fixes min/max()/json() of map result. Before, it was taken as a lazy byte string and stringified by evalfuncarg().
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Mar 2018 23:36:52 +0900
parents afd7b0afe4a6
children 7b2955624777
line wrap: on
line diff
--- a/tests/test-command-template.t	Thu Jan 18 12:54:01 2018 +0100
+++ b/tests/test-command-template.t	Sun Mar 18 23:36:52 2018 +0900
@@ -3217,7 +3217,7 @@
   hg: parse error: None is not iterable of mappings
   [255]
   $ hg log -R latesttag -r tip -T '{extras % "{key}\n" % "{key}\n"}'
-  hg: parse error: <generator *> is not iterable of mappings (glob)
+  hg: parse error: list of strings is not mappable
   [255]
 
 Test new-style inline templating of non-list/dict type:
@@ -3255,6 +3255,13 @@
   $ hg log -R latesttag -l1 -T '{max(revset("9:10"))}\n'
   10
 
+Test min/max over map operation:
+
+  $ hg log -R latesttag -r3 -T '{min(tags % "{tag}")}\n'
+  at3
+  $ hg log -R latesttag -r3 -T '{max(tags % "{tag}")}\n'
+  t3
+
 Test min/max of if() result
 
   $ cd latesttag
@@ -3842,6 +3849,11 @@
   $ hg log -r0 -T '{extras|json}\n'
   {"branch": "default"}
 
+Test json filter applied to map result:
+
+  $ hg log -r0 -T '{json(extras % "{key}")}\n'
+  ["branch"]
+
 Test localdate(date, tz) function:
 
   $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n'