Skip to content

Commit cf03a66

Browse files
committed
Add tests to deal with variable declarations in for loop initialization
1 parent 915b8b1 commit cf03a66

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
html: '<p>33</p><p>32</p>'
3+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script>
2+
import { writable } from "svelte/store";
3+
for (var { a = writable(4), z: b } = { z: writable(3) }; $a * $b < 1000; ) {
4+
a.update(c => c + 1);
5+
b.update(b => b + 1);
6+
}
7+
</script>
8+
9+
<p>{$a}</p>
10+
<p>{$b}</p>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
html: '<p>0</p><p>1</p><p>2</p><p>3</p><p>4</p>'
3+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script>
2+
import { writable } from "svelte/store";
3+
const array = [];
4+
for (var i = writable(0); $i < 5; ) {
5+
array.push($i);
6+
i.update(n => n + 1);
7+
}
8+
</script>
9+
10+
{#each array as a}
11+
<p>{a}</p>
12+
{/each}

0 commit comments

Comments
 (0)