arrays can now be printed

This commit is contained in:
Arne Döring 2017-05-29 17:53:20 +02:00
commit 1f7fc7f279
5 changed files with 81 additions and 25 deletions

View file

@ -12,14 +12,16 @@ inf
-inf
nan
nil
nil'''
nil
(a: 0, b: nil)
nil
ptr (a: 0, b: nil)'''
"""
echo($(@[23, 45]))
echo($(@["", "foo", "bar"]))
#echo($(["", "foo", "bar"]))
#echo($([23, 45]))
# bug #2395
let alphaSet: set[char] = {'a'..'c'}
@ -40,3 +42,30 @@ var x: seq[string]
var y: string
echo(x)
echo(y)
type
Foo = object
a: int
b: string
var foo1: Foo
var foo2: ref Foo
var foo3: ptr Foo = foo1.addr
echo foo1
echo foo2
echo foo3
const
data = @['a','b', '\0', 'c','d']
dataStr = $data
# ensure same result when on VM or when at program execution
doAssert dataStr == $data
import strutils
# array test
let arr = ['H','e','l','l','o',' ','W','o','r','l','d','!','\0']
doAssert startsWith($arr, "[H, e, l, l, o, , W, o, r, l, d, !,")
doAssert newString(arr) == "Hello World!"