tests: document behavior of indent() with empty first line
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 15 Nov 2019 10:16:22 -0800
changeset 43694 0fd9e7a1cf36
parent 43693 f0b33e5f0cf4
child 43695 fa246ada356b
tests: document behavior of indent() with empty first line indent() is documented to indent all non-empty lines, but it still indents the first line even if it's empty. Let's have tests for that. Differential Revision: https://phab.mercurial-scm.org/D7431
tests/test-template-functions.t
--- a/tests/test-template-functions.t	Sat Nov 16 12:08:02 2019 -0800
+++ b/tests/test-template-functions.t	Fri Nov 15 10:16:22 2019 -0800
@@ -1504,6 +1504,21 @@
   
   >> other 3
 
+Test indent with empty first line
+
+  $ hg version -T "{indent('', '>> ')}\n"
+  >> 
+
+  $ hg version -T "{indent('
+  > second', '>> ')}\n"
+  >> 
+  >> second
+
+  $ hg version -T "{indent('
+  > second', '>> ', ' > ')}\n"
+   > 
+  >> second
+
 Test with non-strings like dates
 
   $ hg log -T "{indent(date, '   ')}\n" -r 2:3 -R a