summary refs log tree commit diff stats
path: root/tests/js/tnilstrs.nim
blob: 6c1e4e4016b12923e93f60b7ad73bf59ccb9a678 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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"

block:
  type Foo = object
    a: string
  var foo = Foo(a: "foo")
  var y = move foo.a
  doAssert foo.a.len == 0
  doAssert y == "foo"