fix items for cstring for the JS target; makes tests green again
This commit is contained in:
parent
b3c3a46317
commit
e0fd1cdb5f
2 changed files with 13 additions and 6 deletions
|
|
@ -2195,6 +2195,13 @@ iterator items*[T](a: set[T]): T {.inline.} =
|
||||||
|
|
||||||
iterator items*(a: cstring): char {.inline.} =
|
iterator items*(a: cstring): char {.inline.} =
|
||||||
## iterates over each item of `a`.
|
## iterates over each item of `a`.
|
||||||
|
when defined(js):
|
||||||
|
var i = 0
|
||||||
|
var L = len(a)
|
||||||
|
while i < L:
|
||||||
|
yield a[i]
|
||||||
|
inc(i)
|
||||||
|
else:
|
||||||
var i = 0
|
var i = 0
|
||||||
while a[i] != '\0':
|
while a[i] != '\0':
|
||||||
yield a[i]
|
yield a[i]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''(x: 0, y: 0)
|
output: '''(x: 0, y: 0)
|
||||||
(x: 5, y: 0)
|
(x: 5, y: 0)
|
||||||
@[(x: 2, y: 4), (x: 4, y: 5), (x: 4, y: 5)]
|
@[(x: "2", y: 4), (x: "4", y: 5), (x: "4", y: 5)]
|
||||||
@[(a: 3, b: 3), (a: 1, b: 1), (a: 2, b: 2)]
|
@[(a: "3", b: 3), (a: "1", b: 1), (a: "2", b: 2)]
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue