2015-05-30 22:17:58 +02:00
|
|
|
var map = {
|
|
|
|
|
"a": 1,
|
|
|
|
|
"b": 2,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IO.print(map["a"]) // expect: 1
|
|
|
|
|
IO.print(map["b"]) // expect: 2
|
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
|
|
|
|
|
// 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.
|