1
0
forked from Mirror/wren
Files
wren/test/language/map/trailing_comma.wren

14 lines
492 B
Plaintext
Raw Normal View History

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
// 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.