summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2021-01-10 15:51:29 -0600
committerGitHub <noreply@github.com>2021-01-10 21:51:29 +0000
commit2c6f5ae6815367dcb44e441c8f3bda2e2513b061 (patch)
tree19a35b466342d141512cc5adc49f10354cb96cbe /tests
parentf82100ac93ddb8977d2a404d2cd85975114f50ab (diff)
downloadNim-2c6f5ae6815367dcb44e441c8f3bda2e2513b061.tar.gz
fix #16650 (#16660)
Diffstat (limited to 'tests')
-rw-r--r--tests/system/tostring.nim19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/system/tostring.nim b/tests/system/tostring.nim
index 4ff363075..fa82acc3b 100644
--- a/tests/system/tostring.nim
+++ b/tests/system/tostring.nim
@@ -1,7 +1,3 @@
-discard """
-  output: "DONE: tostring.nim"
-"""
-
 doAssert "@[23, 45]" == $(@[23, 45])
 doAssert "[32, 45]" == $([32, 45])
 doAssert """@["", "foo", "bar"]""" == $(@["", "foo", "bar"])
@@ -108,7 +104,7 @@ bar(nilstring)
 static:
   stringCompare()
 
-# bug 8847
+# issue #8847
 var a2: cstring = "fo\"o2"
 
 block:
@@ -116,5 +112,14 @@ block:
   s.addQuoted a2
   doAssert s == "\"fo\\\"o2\""
 
-
-echo "DONE: tostring.nim"
+# issue #16650
+template fn() =
+  doAssert len(cstring"ab\0c") == 5
+  doAssert len(cstring("ab\0c")) == 2
+  when nimvm:
+    discard
+  else:
+    let c = cstring("ab\0c")
+    doAssert len(c) == 2
+fn()
+static: fn()