Add tests for empty IntSeq iteration (#1739)

This commit is contained in:
Daniel Chao
2026-07-08 06:37:56 -07:00
committed by GitHub
parent bd83e29641
commit 010d971af0
6 changed files with 42 additions and 0 deletions
@@ -30,6 +30,20 @@ res1d = new Dynamic {
}
}
// noinspection ReplaceForGeneratorWithSpread
res1e = new Dynamic {
for (n in IntSeq(0, -1)) {
n
}
}
// noinspection ReplaceForGeneratorWithSpread
res1f = new Dynamic {
for (n in IntSeq(0, 1).step(-1)) {
n
}
}
res2 = new Listing {
for (n in List(1, 2, 3, 4, 5)) {
when (n.isOdd) {
@@ -32,6 +32,20 @@ res1d = test.catch(() -> new Listing {
}
})
// noinspection ReplaceForGeneratorWithSpread
res1e = new Dynamic {
for (n: Int in IntSeq(0, -1)) {
n
}
}
// noinspection ReplaceForGeneratorWithSpread
res1f = new Dynamic {
for (n: Int in IntSeq(0, 1).step(-1)) {
n
}
}
res2 = new Dynamic {
for (n: Number in List(1, 2, 3, 4, 5)) {
when (n.isOdd) {
@@ -85,3 +85,11 @@ res19 = new Listing {
0
0
}
res20 = new Listing {
...IntSeq(0, -1)
}
res21 = new Listing {
...IntSeq(0, 1).step(-1)
}
@@ -18,6 +18,8 @@ res1d {
6
20
}
res1e {}
res1f {}
res2 {
2
6
@@ -10,6 +10,8 @@ res1c {
20
}
res1d = "Expected value of type `String`, but got type `Int`. Value: 0"
res1e {}
res1f {}
res2 {
2
6
@@ -119,3 +119,5 @@ res19 {
0
0
}
res20 {}
res21 {}