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

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

Issue 148883006: polymer_expressions: Add % as an operator. Test all operators.. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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/lib/tokenizer.dart ('k') | no next file » | 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 f943d221b9022ac7ea824cd1052de3ab75a35da9..e57d11a3ccafb5ef1b997b9cc9c2822e459da791 100644
--- a/pkg/polymer_expressions/test/parser_test.dart
+++ b/pkg/polymer_expressions/test/parser_test.dart
@@ -52,15 +52,14 @@ main() {
expectParse('-1.23', literal(-1.23));
});
- test('should parse a plus operator with literals', () {
- expectParse('1 + 2', binary(literal(1), '+', literal(2)));
- });
-
test('should parse binary operators', () {
- expectParse('a && b', binary(ident('a'), '&&', ident('b')));
- expectParse('1 && 2', binary(literal(1), '&&', literal(2)));
- expectParse('false && true', binary(literal(false), '&&', literal(true)));
- expectParse('false || true', binary(literal(false), '||', literal(true)));
+ var operators = ['+', '-', '*', '/', '%', '^', '==', '!=', '>', '<',
+ '>=', '<=', '||', '&&', '&'];
+ for (var op in operators) {
+ expectParse('a $op b', binary(ident('a'), op, ident('b')));
+ expectParse('1 $op 2', binary(literal(1), op, literal(2)));
+ expectParse('this $op null', binary(ident('this'), op, literal(null)));
+ }
});
test('should give multiply higher associativity than plus', () {
@@ -71,14 +70,6 @@ main() {
binary(ident('b'), '*', ident('c'))));
});
- test('should give multiply higher associativity than plus 2', () {
- expectParse('a * b + c',
- binary(
- binary(ident('a'), '*', ident('b')),
- '+',
- ident('c')));
- });
-
test('should parse a dot operator', () {
expectParse('a.b', getter(ident('a'), 'b'));
});
« no previous file with comments | « pkg/polymer_expressions/lib/tokenizer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698