mirror of
https://github.com/apple/pkl.git
synced 2026-07-09 06:25:16 +02:00
Add tests for empty IntSeq iteration (#1739)
This commit is contained in:
+14
@@ -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 {
|
res2 = new Listing {
|
||||||
for (n in List(1, 2, 3, 4, 5)) {
|
for (n in List(1, 2, 3, 4, 5)) {
|
||||||
when (n.isOdd) {
|
when (n.isOdd) {
|
||||||
|
|||||||
+14
@@ -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 {
|
res2 = new Dynamic {
|
||||||
for (n: Number in List(1, 2, 3, 4, 5)) {
|
for (n: Number in List(1, 2, 3, 4, 5)) {
|
||||||
when (n.isOdd) {
|
when (n.isOdd) {
|
||||||
|
|||||||
+8
@@ -85,3 +85,11 @@ res19 = new Listing {
|
|||||||
0
|
0
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res20 = new Listing {
|
||||||
|
...IntSeq(0, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
res21 = new Listing {
|
||||||
|
...IntSeq(0, 1).step(-1)
|
||||||
|
}
|
||||||
|
|||||||
+2
@@ -18,6 +18,8 @@ res1d {
|
|||||||
6
|
6
|
||||||
20
|
20
|
||||||
}
|
}
|
||||||
|
res1e {}
|
||||||
|
res1f {}
|
||||||
res2 {
|
res2 {
|
||||||
2
|
2
|
||||||
6
|
6
|
||||||
|
|||||||
+2
@@ -10,6 +10,8 @@ res1c {
|
|||||||
20
|
20
|
||||||
}
|
}
|
||||||
res1d = "Expected value of type `String`, but got type `Int`. Value: 0"
|
res1d = "Expected value of type `String`, but got type `Int`. Value: 0"
|
||||||
|
res1e {}
|
||||||
|
res1f {}
|
||||||
res2 {
|
res2 {
|
||||||
2
|
2
|
||||||
6
|
6
|
||||||
|
|||||||
+2
@@ -119,3 +119,5 @@ res19 {
|
|||||||
0
|
0
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
res20 {}
|
||||||
|
res21 {}
|
||||||
|
|||||||
Reference in New Issue
Block a user