diff options
Diffstat (limited to 'tests/js/test1.nim')
-rw-r--r-- | tests/js/test1.nim | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/tests/js/test1.nim b/tests/js/test1.nim index 7f1d346f0..7ad3f85f6 100644 --- a/tests/js/test1.nim +++ b/tests/js/test1.nim @@ -4,8 +4,7 @@ discard """ # This file tests the JavaScript generator -import - dom, strutils +import strutils var inputElement = "1123" @@ -20,3 +19,34 @@ 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]) |