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

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: syntax, bindings, and globals tests now passing in Safari Created 6 years, 7 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
« no previous file with comments | « pkg/polymer_expressions/test/globals_test.dart ('k') | pkg/polymer_expressions/test/syntax_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 09de5d61f0c7c8ef681453f383ad20e05a0dd2f3..04f2ee72d5e5ac9c012c5cdf2cb02c41cca32912 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', () {
@@ -181,7 +180,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')));
@@ -193,8 +192,15 @@ main() {
expect(() => parse('a + 1 in b'), throwsException);
});
- test('should reject keywords as identifiers', () {
- expect(() => parse('a.in'), throwsException);
+ test('should parse "as" expressions', () {
+ expectParse('a as b', asExpr(ident('a'), ident('b')));
+ });
+
+ skip_test('should reject keywords as identifiers', () {
+ 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', () {
« no previous file with comments | « pkg/polymer_expressions/test/globals_test.dart ('k') | pkg/polymer_expressions/test/syntax_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698