tnilconcats.nim 460 B

123456789101112131415161718192021222324252627282930313233
  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. shallow(s2)
  21. s2 &= "foo"
  22. doAssert s2 == "foo"