forked from Mirror/wren
Add some tests with invalid trailing commas
This commit is contained in:
committed by
Bob Nystrom
parent
b20c9a1b38
commit
d7eed08774
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user