OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library parser_test; | 5 library parser_test; |
6 | 6 |
7 import 'package:polymer_expressions/parser.dart'; | 7 import 'package:polymer_expressions/parser.dart'; |
8 import 'package:polymer_expressions/expression.dart'; | 8 import 'package:polymer_expressions/expression.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 expectParse("{'a': foo('a')}", | 203 expectParse("{'a': foo('a')}", |
204 mapLiteral([mapLiteralEntry( | 204 mapLiteral([mapLiteralEntry( |
205 literal('a'), invoke(ident('foo'), null, [literal('a')]))])); | 205 literal('a'), invoke(ident('foo'), null, [literal('a')]))])); |
206 }); | 206 }); |
207 | 207 |
208 test('should parse map literals with method calls', () { | 208 test('should parse map literals with method calls', () { |
209 expectParse("{'a': 1}.length", | 209 expectParse("{'a': 1}.length", |
210 getter(mapLiteral([mapLiteralEntry(literal('a'), literal(1))]), | 210 getter(mapLiteral([mapLiteralEntry(literal('a'), literal(1))]), |
211 'length')); | 211 'length')); |
212 }); | 212 }); |
| 213 |
| 214 test('should parse list literals', () { |
| 215 expectParse('[1, "a", b]', |
| 216 listLiteral([literal(1), literal('a'), ident('b')])); |
| 217 expectParse('[[1, 2], [3, 4]]', |
| 218 listLiteral([listLiteral([literal(1), literal(2)]), |
| 219 listLiteral([literal(3), literal(4)])])); |
| 220 }); |
213 }); | 221 }); |
214 } | 222 } |
OLD | NEW |