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

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

Issue 10870066: Support unary - operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix unparser to handle that negate is no longer a keyword. Created 8 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 | Annotate | Revision Log
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("../../../lib/compiler/implementation/tree/tree.dart"); 6 #import("../../../lib/compiler/implementation/tree/tree.dart");
7 7
8 void testStatement(String statement) { 8 void testStatement(String statement) {
9 Node node = parseStatement(statement); 9 Node node = parseStatement(statement);
10 Expect.isNotNull(node.toString()); 10 Expect.isNotNull(node.toString());
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 Expect.stringEquals("++", sendSet.assignmentOperator.toString()); 253 Expect.stringEquals("++", sendSet.assignmentOperator.toString());
254 Expect.isTrue(sendSet.arguments.isEmpty()); 254 Expect.isTrue(sendSet.arguments.isEmpty());
255 } 255 }
256 256
257 void testOperatorParse() { 257 void testOperatorParse() {
258 FunctionDeclaration node = parseStatement('operator negate() => null;'); 258 FunctionDeclaration node = parseStatement('operator negate() => null;');
259 FunctionExpression function = node.function; 259 FunctionExpression function = node.function;
260 Send name = function.name.asSend(); 260 Send name = function.name.asSend();
261 Expect.isNotNull(name); 261 Expect.isNotNull(name);
262 Expect.stringEquals('operator', name.receiver.source.stringValue); 262 Expect.stringEquals('operator', name.receiver.source.stringValue);
263 Expect.stringEquals('negate', name.selector.source.stringValue); 263 Expect.equals(buildSourceString('negate'), name.selector.source);
264 Expect.isTrue(function.parameters.isEmpty()); 264 Expect.isTrue(function.parameters.isEmpty());
265 Expect.isNull(function.returnType); 265 Expect.isNull(function.returnType);
266 Expect.isNull(function.getOrSet); 266 Expect.isNull(function.getOrSet);
267 } 267 }
268 268
269 void main() { 269 void main() {
270 testGenericTypes(); 270 testGenericTypes();
271 // TODO(ahe): Enable this test when we handle library prefixes. 271 // TODO(ahe): Enable this test when we handle library prefixes.
272 // testPrefixedGenericTypes(); 272 // testPrefixedGenericTypes();
273 testUnaryExpression(); 273 testUnaryExpression();
274 testChainedMethodCalls(); 274 testChainedMethodCalls();
275 testFunctionStatement(); 275 testFunctionStatement();
276 testDoStatement(); 276 testDoStatement();
277 testWhileStatement(); 277 testWhileStatement();
278 testConditionalExpression(); 278 testConditionalExpression();
279 testAssignment(); 279 testAssignment();
280 testIndex(); 280 testIndex();
281 testPostfix(); 281 testPostfix();
282 testOperatorParse(); 282 testOperatorParse();
283 } 283 }
OLDNEW
« no previous file with comments | « dart/tests/compiler/dart2js/mirrors_helper.dart ('k') | dart/tests/compiler/dart2js/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698