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

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

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/mirrors/mirrors.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'parser_helper.dart'; 5 import 'parser_helper.dart';
6 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; 6 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart';
7 7
8 void testNode(Node node, String expected, String text, [bool hard = true]) { 8 void testNode(Node node, String expected, String text, [bool hard = true]) {
9 var debug = 'text=$text,expected=$expected,node:${node}'; 9 var debug = 'text=$text,expected=$expected,node:${node}';
10 Expect.isNotNull(node, debug); 10 Expect.isNotNull(node, debug);
11 11
12 Token beginToken = node.getBeginToken(); 12 Token beginToken = node.getBeginToken();
13 Expect.isNotNull(beginToken, debug); 13 Expect.isNotNull(beginToken, debug);
14 Token endToken = node.getEndToken(); 14 Token endToken = node.getEndToken();
15 Expect.isNotNull(endToken, debug); 15 Expect.isNotNull(endToken, debug);
16 16
17 int begin = beginToken.charOffset; 17 int begin = beginToken.charOffset;
18 int end = endToken.charOffset + endToken.slowCharCount; 18 int end = endToken.charOffset + endToken.slowCharCount;
19 Expect.isTrue(begin <= end, debug); 19 Expect.isTrue(begin <= end, debug);
20 20
21 if (hard) { 21 if (hard) {
22 Expect.stringEquals(expected, text.substring(begin, end), debug); 22 Expect.stringEquals(expected, text.substring(begin, end), debug);
23 } 23 }
24 } 24 }
25 25
26 Node testExpression(String text, [String alternate]) { 26 Node testExpression(String text, [String alternate]) {
27 var node = parseStatement('$text;').expression; 27 var node = parseStatement('$text;').expression;
28 testNode(node, alternate === null ? text : alternate, text); 28 testNode(node, alternate == null ? text : alternate, text);
29 return node; 29 return node;
30 } 30 }
31 31
32 void testUnaryExpression() { 32 void testUnaryExpression() {
33 testExpression('x++'); 33 testExpression('x++');
34 testExpression('++x'); 34 testExpression('++x');
35 } 35 }
36 36
37 void testAssignment() { 37 void testAssignment() {
38 Expression node; 38 Expression node;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 testNode(sendSet.assignmentOperator, "++", text); 163 testNode(sendSet.assignmentOperator, "++", text);
164 testNode(sendSet.arguments.head, "b", text); 164 testNode(sendSet.arguments.head, "b", text);
165 } 165 }
166 166
167 void main() { 167 void main() {
168 testUnaryExpression(); 168 testUnaryExpression();
169 testAssignment(); 169 testAssignment();
170 testIndex(); 170 testIndex();
171 testPostfix(); 171 testPostfix();
172 } 172 }
OLDNEW
« no previous file with comments | « sdk/lib/mirrors/mirrors.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698