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

Side by Side Diff: tests/compiler/dart2js/parser_test.dart

Issue 1562023002: Add test of unittests. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'parser_helper.dart'; 6 import 'parser_helper.dart';
7 import 'package:compiler/src/tree/tree.dart'; 7 import 'package:compiler/src/tree/tree.dart';
8 8
9 void testStatement(String statement) { 9 void testStatement(String statement) {
10 Node node = parseStatement(statement); 10 Node node = parseStatement(statement);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 node = parseStatement("a ?? b ? c : d;"); 148 node = parseStatement("a ?? b ? c : d;");
149 // Should parse as: (a ?? b) ? c : d; 149 // Should parse as: (a ?? b) ? c : d;
150 conditional = node.expression; 150 conditional = node.expression;
151 Expect.isNotNull(conditional.condition.asSend()); 151 Expect.isNotNull(conditional.condition.asSend());
152 Expect.isTrue(conditional.condition.asSend().isIfNull); 152 Expect.isTrue(conditional.condition.asSend().isIfNull);
153 Expect.isNotNull(conditional.thenExpression.asSend()); 153 Expect.isNotNull(conditional.thenExpression.asSend());
154 Expect.isNotNull(conditional.elseExpression.asSend()); 154 Expect.isNotNull(conditional.elseExpression.asSend());
155 } 155 }
156 156
157 void testNullOperators() { 157 void testNullOperators() {
158 Expression node = parseStatement("a ?? b;").expression; 158 ExpressionStatement statement = parseStatement("a ?? b;");
159 Expression node = statement.expression;
159 Expect.isNotNull(node.asSend()); 160 Expect.isNotNull(node.asSend());
160 Expect.isTrue(node.asSend().isIfNull); 161 Expect.isTrue(node.asSend().isIfNull);
161 162
162 node = parseStatement("a ??= b;").expression; 163 statement = parseStatement("a ??= b;");
164 node = statement.expression;
163 Expect.isNotNull(node.asSendSet()); 165 Expect.isNotNull(node.asSendSet());
164 Expect.isTrue(node.asSendSet().isIfNullAssignment); 166 Expect.isTrue(node.asSendSet().isIfNullAssignment);
165 167
166 node = parseStatement("a?.b;").expression; 168 statement = parseStatement("a?.b;");
169 node = statement.expression;
167 Expect.isNotNull(node.asSend()); 170 Expect.isNotNull(node.asSend());
168 Expect.isTrue(node.asSend().isConditional); 171 Expect.isTrue(node.asSend().isConditional);
169 172
170 node = parseStatement("a?.m();").expression; 173 statement = parseStatement("a?.m();");
174 node = statement.expression;
171 Expect.isNotNull(node.asSend()); 175 Expect.isNotNull(node.asSend());
172 Expect.isTrue(node.asSend().isConditional); 176 Expect.isTrue(node.asSend().isConditional);
173 } 177 }
174 178
175 void testAssignment() { 179 void testAssignment() {
176 ExpressionStatement node; 180 ExpressionStatement node;
177 Expression expression; 181 Expression expression;
178 SendSet sendSet; 182 SendSet sendSet;
179 183
180 node = parseStatement("a = b;"); 184 node = parseStatement("a = b;");
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 testConditionalExpression(); 375 testConditionalExpression();
372 testNullOperators(); 376 testNullOperators();
373 testAssignment(); 377 testAssignment();
374 testIndex(); 378 testIndex();
375 testPostfix(); 379 testPostfix();
376 testOperatorParse(); 380 testOperatorParse();
377 testMissingCloseParen(); 381 testMissingCloseParen();
378 testMissingCloseBraceInClass(); 382 testMissingCloseBraceInClass();
379 testUnmatchedAngleBracket(); 383 testUnmatchedAngleBracket();
380 } 384 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698