diff options
author | Yuriy Glukhov <yglukhov@users.noreply.github.com> | 2018-12-21 23:45:20 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-12-21 22:45:20 +0100 |
commit | 39a8ab469a8596a413d75d85e3ed7587783b353d (patch) | |
tree | 4b92c9e6d02c22d96bc54316eeab42820b2790fe /tests/js | |
parent | 237085db5d7ff29a2d0e18937f08f1769c38433a (diff) | |
download | Nim-39a8ab469a8596a413d75d85e3ed7587783b353d.tar.gz |
Fixed insert for nil seq in js (#10068)
Diffstat (limited to 'tests/js')
-rw-r--r-- | tests/js/test1.nim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/js/test1.nim b/tests/js/test1.nim index 7f1d346f0..73e7a37ed 100644 --- a/tests/js/test1.nim +++ b/tests/js/test1.nim @@ -20,3 +20,35 @@ proc onButtonClick(inputElement: string) {.exportc.} = onButtonClick(inputElement) +block: + var s: string + s.add("hi") + doAssert(s == "hi") + +block: + var s: string + s.insert("hi", 0) + doAssert(s == "hi") + +block: + var s: string + s.setLen(2) + s[0] = 'h' + s[1] = 'i' + doAssert(s == "hi") + +block: + var s: seq[int] + s.setLen(2) + doAssert(s == @[0, 0]) + +block: + var s: seq[int] + s.insert(2, 0) + doAssert(s == @[2]) + +block: + var s: seq[int] + s.add(2) + doAssert(s == @[2]) + |