changeset 43694:0fd9e7a1cf36

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
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 15 Nov 2019 10:16:22 -0800
parents f0b33e5f0cf4
children fa246ada356b
files tests/test-template-functions.t
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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