##// END OF EJS Templates
templater: fix truth testing of integer 0 taken from a list/dict...
Yuya Nishihara -
r38466:b6294c11 default
parent child Browse files
Show More
@@ -350,7 +350,8 b' class hybriditem(mappable, wrapped):'
350 return gen
350 return gen
351
351
352 def tobool(self, context, mapping):
352 def tobool(self, context, mapping):
353 return bool(self.tovalue(context, mapping))
353 w = makewrapped(context, mapping, self._value)
354 return w.tobool(context, mapping)
354
355
355 def tovalue(self, context, mapping):
356 def tovalue(self, context, mapping):
356 return _unthunk(context, mapping, self._value)
357 return _unthunk(context, mapping, self._value)
@@ -932,6 +932,8 b' Test boolean expression/literal passed t'
932 rev 0 is True
932 rev 0 is True
933 $ hg log -r 0 -T '{if(0, "literal 0 is True as well")}\n'
933 $ hg log -r 0 -T '{if(0, "literal 0 is True as well")}\n'
934 literal 0 is True as well
934 literal 0 is True as well
935 $ hg log -r 0 -T '{if(min(revset(r"0")), "0 of hybriditem is also True")}\n'
936 0 of hybriditem is also True
935 $ hg log -r 0 -T '{if("", "", "empty string is False")}\n'
937 $ hg log -r 0 -T '{if("", "", "empty string is False")}\n'
936 empty string is False
938 empty string is False
937 $ hg log -r 0 -T '{if(revset(r"0 - 0"), "", "empty list is False")}\n'
939 $ hg log -r 0 -T '{if(revset(r"0 - 0"), "", "empty list is False")}\n'
General Comments 0
You need to be logged in to leave comments. Login now