1
0
forked from Mirror/wren

Add some tests with invalid trailing commas

This commit is contained in:
Lukas Werling
2015-05-30 22:17:12 +02:00
committed by Bob Nystrom
parent b20c9a1b38
commit d7eed08774
2 changed files with 11 additions and 0 deletions

View File

@ -5,3 +5,8 @@ var list = [
IO.print(list[0]) // expect: a
IO.print(list[1]) // expect: b
// Invalid syntax
IO.print(new Fiber { Meta.eval("[,]") }.try()) // expect: Could not compile source code.
IO.print(new Fiber { Meta.eval("[1,,]") }.try()) // expect: Could not compile source code.
IO.print(new Fiber { Meta.eval("[1,,2]") }.try()) // expect: Could not compile source code.

View File

@ -5,3 +5,9 @@ var map = {
IO.print(map["a"]) // expect: 1
IO.print(map["b"]) // expect: 2
// Invalid syntax
// Parentheses are necessary to have these interpret as maps and not as blocks.
IO.print(new Fiber { Meta.eval("({,})") }.try()) // expect: Could not compile source code.
IO.print(new Fiber { Meta.eval("({1:1,,})") }.try()) // expect: Could not compile source code.
IO.print(new Fiber { Meta.eval("({1:1,,2:2})") }.try()) // expect: Could not compile source code.