compiler: allow for loops with empty condition

This commit is contained in:
Evgenii Stratonikov 2020-03-26 14:57:57 +03:00
parent 198fffb9b8
commit f0b6f783aa
2 changed files with 22 additions and 3 deletions

View file

@ -374,6 +374,23 @@ func TestDec(t *testing.T) {
eval(t, src, big.NewInt(1))
}
func TestForLoopEmpty(t *testing.T) {
src := `
package foo
func Main() int {
x := 0
for {
x++
if x == 2 {
break
}
}
return x
}
`
eval(t, src, big.NewInt(2))
}
func TestForLoopBigIter(t *testing.T) {
src := `
package foo