tests/tuples/ttuples_issues.nim: test on all backends + various improvements (#16907)

* improve tests/tuples/ttuples_issues.nim: test on all backends

* address comments
This commit is contained in:
Timothee Cour 2021-02-02 11:17:13 -08:00 • committed by GitHub
commit 7b9b76d840
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 103 additions and 90 deletions

5
tests/js/readme.md Normal file
View file

@ -0,0 +1,5 @@
## notes
Prefer moving tests to a non-js directory so that they get tested across all backends automatically.
Ideally, tests/js should be reserved to code that only makes sense in js.
Note also that tests for a js specific module (e.g.: `std/jsbigints`) belong to `tests/stdlib`, (e.g.: `tests/stdlib/tjsbigints.nim`)

View file

@ -1,29 +0,0 @@
block: # bug #16822
var scores: seq[(set[char], int)] = @{{'/'} : 10}
var x1: set[char]
for item in items(scores):
x1 = item[0]
doAssert x1 == {'/'}
var x2: set[char]
for (chars, value) in items(scores):
x2 = chars
doAssert x2 == {'/'}
block: # bug #14574
proc fn(): auto =
let a = @[("foo", (12, 13))]
for (k,v) in a:
return (k,v)
doAssert fn() == ("foo", (12, 13))
block: # bug #14574
iterator fn[T](a:T): lent T = yield a
let a = (10, (11,))
proc bar(): auto =
for (x,y) in fn(a):
return (x,y)
doAssert bar() == (10, (11,))