JS backend properly extends string with setLen (#21087)

* Add test case

* Extend string with '0' when setting length to be longer
This commit is contained in:
Jake Leahy 2022-12-13 18:43:37 +11:00 • committed by GitHub
commit 7ae7832f76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

11
tests/js/t20235.nim Normal file
View file

@ -0,0 +1,11 @@
discard """
action: "run"
output: "0 4"
"""
proc main =
var s = ""
s.setLen(4)
echo s[0].ord, " ", s.len
main()