1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00

Allow empty test/update in for statements

Fix #1
This commit is contained in:
Robert Krimen
2012-10-14 10:42:06 -07:00
parent 7dfbf6ab13
commit 89e26f042e
3 changed files with 39 additions and 7 deletions

View File

@@ -773,6 +773,34 @@ func TestFor(t *testing.T) {
}
`)
test("result", "9")
test(`
abc = 0
for (;;) {
abc += 1
if (abc == 3)
break
}
abc
`, "3")
test(`
for (abc = 0; ;) {
abc += 1
if (abc == 3)
break
}
abc
`, "3")
test(`
for (abc = 0; ; abc+=1) {
abc += 1
if (abc == 3)
break
}
abc
`, "3")
}
func TestArguments(t *testing.T) {
@@ -1844,3 +1872,4 @@ func TestAPI(t *testing.T) {
result, _ = object.Value().Call(def, 3)
Is(result, "30")
}