summary refs log tree commit diff stats
path: root/tests/stdlib/tstrutils2.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-06-10 05:10:57 -0700
committerGitHub <noreply@github.com>2020-06-10 14:10:57 +0200
commit8bbdb8f43fb0da04d4b75bca011662f690972bfe (patch)
tree3dec6af1267a36d12f8b067aca49fb4f0bf95068 /tests/stdlib/tstrutils2.nim
parent5131af1a446140d275510d67bff281f2e42cc19b (diff)
downloadNim-8bbdb8f43fb0da04d4b75bca011662f690972bfe.tar.gz
fix #14545 windows CI docs (#14590)
* fix #14545 windows paths
* add lib/std/private/strutils2.nim
* remove dependency strutils2 => strutils
* address comment: lib/std/private/strutils2.nim => compiler/strutils2.nim
Diffstat (limited to 'tests/stdlib/tstrutils2.nim')
-rw-r--r--tests/stdlib/tstrutils2.nim32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/stdlib/tstrutils2.nim b/tests/stdlib/tstrutils2.nim
new file mode 100644
index 000000000..881817f90
--- /dev/null
+++ b/tests/stdlib/tstrutils2.nim
@@ -0,0 +1,32 @@
+import "$lib/.." / compiler/strutils2
+
+block: # setLen
+  var a = "abc"
+  a.setLen 0
+  a.setLen 3, isInit = false
+  doAssert a[1] == 'b'
+  a.setLen 0
+  a.setLen 3, isInit = true
+  doAssert a[1] == '\0'
+
+block: # forceCopy
+  var a: string
+  a = "foo"
+  shallow(a)
+  var b: string
+  b = a
+  doAssert b[0].addr == a[0].addr
+  var c: string
+  c.forceCopy a
+  doAssert c == a
+  doAssert c[0].addr != a[0].addr
+
+block: # toLowerAscii
+  var a = "fooBAr"
+  a.toLowerAscii
+  doAssert a == "foobar"
+
+block: # dataPointer
+  var a: string
+  discard a.dataPointer
+  # doAssert a.dataPointer == nil # not guaranteed