Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: pkg/polymer_expressions/test/parser_test.dart

Issue 23458017: Add null literals to polymer expressions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer_expressions/test/eval_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 expectParse(String s, Expression e) => 11 expectParse(String s, Expression e) =>
12 expect(new Parser(s).parse(), e, reason: s); 12 expect(new Parser(s).parse(), e, reason: s);
13 13
14 main() { 14 main() {
15 15
16 group('parser', () { 16 group('parser', () {
17 17
18 test('should parse an empty expression', () { 18 test('should parse an empty expression', () {
19 expectParse('', empty()); 19 expectParse('', empty());
20 }); 20 });
21 21
22 test('should parse an identifier', () { 22 test('should parse an identifier', () {
23 expectParse('abc', ident('abc')); 23 expectParse('abc', ident('abc'));
24 }); 24 });
25 25
26 test('should parse a string literal', () { 26 test('should parse a string literal', () {
27 expectParse('"abc"', literal('abc')); 27 expectParse('"abc"', literal('abc'));
28 }); 28 });
29 29
30 test('should parse a bool literal', () {
31 expectParse('true', literal(true));
32 expectParse('false', literal(false));
33 });
34
35 test('should parse a null literal', () {
36 expectParse('null', literal(null));
37 });
38
30 test('should parse an integer literal', () { 39 test('should parse an integer literal', () {
31 expectParse('123', literal(123)); 40 expectParse('123', literal(123));
32 }); 41 });
33 42
34 test('should parse a double literal', () { 43 test('should parse a double literal', () {
35 expectParse('1.23', literal(1.23)); 44 expectParse('1.23', literal(1.23));
36 }); 45 });
37 46
38 test('should parse a positive double literal', () { 47 test('should parse a positive double literal', () {
39 expectParse('+1.23', literal(1.23)); 48 expectParse('+1.23', literal(1.23));
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 literal('a'), invoke(ident('foo'), null, [literal('a')]))])); 199 literal('a'), invoke(ident('foo'), null, [literal('a')]))]));
191 }); 200 });
192 201
193 test('should parse map literals with method calls', () { 202 test('should parse map literals with method calls', () {
194 expectParse("{'a': 1}.length", 203 expectParse("{'a': 1}.length",
195 invoke(mapLiteral([mapLiteralEntry(literal('a'), literal(1))]), 204 invoke(mapLiteral([mapLiteralEntry(literal('a'), literal(1))]),
196 'length')); 205 'length'));
197 }); 206 });
198 }); 207 });
199 } 208 }
OLDNEW
« no previous file with comments | « pkg/polymer_expressions/test/eval_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698