tnilconcats.nim 486 B

12345678910111213141516171819202122232425262728293031323334
  1. discard """
  2. output: '''@["", "", "", "", "", "", "", "meh"]'''
  3. exitcode: "0"
  4. """
  5. when true:
  6. var ab: string
  7. ab &= "more"
  8. doAssert ab == "more"
  9. var x: seq[string]
  10. setLen(x, 7)
  11. x.add "meh"
  12. var s: string
  13. var z = "abc"
  14. var zz: string
  15. s &= "foo" & z & zz
  16. doAssert s == "fooabc"
  17. echo x
  18. # casting an empty string as sequence with shallow() should not segfault
  19. var s2: string
  20. when defined(gcRefc):
  21. shallow(s2)
  22. s2 &= "foo"
  23. doAssert s2 == "foo"