2015-05-30 22:18:37 +02:00
|
|
|
var list = [
|
|
|
|
|
"a",
|
|
|
|
|
"b",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
IO.print(list[0]) // expect: a
|
|
|
|
|
IO.print(list[1]) // expect: b
|
test: add invalid trailing comma tests for list and map literals
Add test cases verifying that invalid trailing comma syntaxes in list literals
(e.g. `[,]`, `[1,,]`, `[1,,2]`) and map literals (e.g. `{,}`, `{1:1,,}`, `{1:1,,2:2}`)
correctly produce compile errors when evaluated via Meta.eval in a Fiber.
2015-05-30 22:17:12 +02:00
|
|
|
|
|
|
|
|
// 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.
|