Fix printing and comparing uninitialized strings

This commit is contained in:
recloser 2018-10-21 21:18:10 +02:00
commit 2b03bed2db
4 changed files with 20 additions and 9 deletions

View file

@ -1,4 +0,0 @@
var x = "foo".cstring
var y: string
add(y, x)
doAssert y == "foo"

17
tests/js/tnilstrs.nim Normal file
View file

@ -0,0 +1,17 @@
block:
var x: string
var y = "foo"
echo x
doAssert x == ""
doAssert "" == x
add(x, y)
y[0] = 'm'
doAssert y == "moo" and x == "foo"
block:
var x = "foo".cstring
var y: string
add(y, x)
doAssert y == "foo"

View file

@ -1,5 +0,0 @@
var x: string
var y = "foo"
add(x, y)
y[0] = 'm'
doAssert y == "moo" and x == "foo"