summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorClyybber <darkmine956@gmail.com>2020-09-22 10:43:12 +0200
committerGitHub <noreply@github.com>2020-09-22 10:43:12 +0200
commitd67c5cb75171fcbf1ca9078452e8fcbe36fc79bc (patch)
tree461841c502d8921b1b4b42c46f66930ad17f6f79 /tests
parentaca9c5fb30fe2de12671e9103e93b81201bb8e71 (diff)
downloadNim-d67c5cb75171fcbf1ca9078452e8fcbe36fc79bc.tar.gz
Add strutils.indentation and make unindent use it (#15264)
* Add strutils.indentation and make unindent use it

* Code style

* Fix bootstrapping

* Improve wording

* Fix test

* Introduce without breaking change

* Fix

* Reduce diff

* Fix docs link

* Add since annotation

* Update changelog
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tstrutil.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/stdlib/tstrutil.nim b/tests/stdlib/tstrutil.nim
index ef5b041be..162b8ea1b 100644
--- a/tests/stdlib/tstrutil.nim
+++ b/tests/stdlib/tstrutil.nim
@@ -435,3 +435,25 @@ block:
   doAssert a == f1
   doAssert b == f2
   doAssert c == f3
+
+block:
+  assert 0 == indentation """
+hey
+  low
+    there
+"""
+  assert 2 == indentation """
+  hey
+    low
+      there
+"""
+  assert 2 == indentation """  hey
+    low
+      there
+"""
+  assert 2 == indentation """  hey
+    low
+      there"""
+  assert 0 == indentation ""
+  assert 0 == indentation "  \n  \n"
+  assert 0 == indentation "    "