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

Unified Diff: pkg/polymer_expressions/test/parser_test.dart

Issue 141703024: Refactor of PolymerExpressions. Adds "as" expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: pkg/polymer_expressions/test/parser_test.dart
diff --git a/pkg/polymer_expressions/test/parser_test.dart b/pkg/polymer_expressions/test/parser_test.dart
index e57d11a3ccafb5ef1b997b9cc9c2822e459da791..d7f06ac25f19d38a19f61601b16efedab162a3b8 100644
--- a/pkg/polymer_expressions/test/parser_test.dart
+++ b/pkg/polymer_expressions/test/parser_test.dart
@@ -64,10 +64,9 @@ main() {
test('should give multiply higher associativity than plus', () {
expectParse('a + b * c',
- binary(
- ident('a'),
- '+',
- binary(ident('b'), '*', ident('c'))));
+ binary(ident('a'), '+', binary(ident('b'), '*', ident('c'))));
+ expectParse('a * b + c',
+ binary(binary(ident('a'), '*', ident('b')), '+', ident('c')));
});
test('should parse a dot operator', () {
@@ -164,7 +163,7 @@ main() {
'|', ident('c')));
});
- test('should parse comprehension', () {
+ test('should parse "in" expression', () {
expectParse('a in b', inExpr(ident('a'), ident('b')));
expectParse('a in b.c',
inExpr(ident('a'), getter(ident('b'), 'c')));
@@ -176,8 +175,15 @@ main() {
expect(() => parse('a + 1 in b'), throwsException);
});
+ test('should parse "as" expressions', () {
+ expectParse('a as b', asExpr(ident('a'), ident('b')));
+ });
+
test('should reject keywords as identifiers', () {
- expect(() => parse('a.in'), throwsException);
+ expect(() => parse('a.in'), throws);
+ expect(() => parse('a.as'), throws);
+ // TODO: re-enable when 'this' is a keyword
+// expect(() => parse('a.this'), throws);
});
test('should parse map literals', () {

Powered by Google App Engine
This is Rietveld 408576698