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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 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
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 testNode(Node node, String expected, String text, [bool hard = true]) { 9 void testNode(Node node, String expected, String text, [bool hard = true]) {
10 var debug = 'text=$text,expected=$expected,node:${node}'; 10 var debug = 'text=$text,expected=$expected,node:${node}';
11 Expect.isNotNull(node, debug); 11 Expect.isNotNull(node, debug);
12 12
13 Token beginToken = node.getBeginToken(); 13 Token beginToken = node.getBeginToken();
14 Expect.isNotNull(beginToken, debug); 14 Expect.isNotNull(beginToken, debug);
15 Token endToken = node.getEndToken(); 15 Token endToken = node.getEndToken();
16 Expect.isNotNull(endToken, debug); 16 Expect.isNotNull(endToken, debug);
17 17
18 int begin = beginToken.charOffset; 18 int begin = beginToken.charOffset;
19 int end = endToken.charOffset + endToken.charCount; 19 int end = endToken.charOffset + endToken.charCount;
20 Expect.isTrue(begin <= end, debug); 20 Expect.isTrue(begin <= end, debug);
21 21
22 if (hard) { 22 if (hard) {
23 » Expect.stringEquals(expected, text.substring(begin, end), debug); 23 Expect.stringEquals(expected, text.substring(begin, end), debug);
24 } 24 }
25 } 25 }
26 26
27 Node testExpression(String text, [String alternate]) { 27 Node testExpression(String text, [String alternate]) {
28 ExpressionStatement statement = parseStatement('$text;'); 28 ExpressionStatement statement = parseStatement('$text;');
29 Expression node = statement.expression; 29 Expression node = statement.expression;
30 testNode(node, alternate == null ? text : alternate, text); 30 testNode(node, alternate == null ? text : alternate, text);
31 return node; 31 return node;
32 } 32 }
33 33
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 testNode(sendSet.assignmentOperator, "++", text); 165 testNode(sendSet.assignmentOperator, "++", text);
166 testNode(sendSet.arguments.head, "b", text); 166 testNode(sendSet.arguments.head, "b", text);
167 } 167 }
168 168
169 void main() { 169 void main() {
170 testUnaryExpression(); 170 testUnaryExpression();
171 testAssignment(); 171 testAssignment();
172 testIndex(); 172 testIndex();
173 testPostfix(); 173 testPostfix();
174 } 174 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/bad_output_io_test.dart ('k') | tests/compiler/dart2js/benign_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698