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

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

Issue 11783089: Fix VariableDefinitions.endToken for formal parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test added to unparser_test. Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 'dart:uri'; 5 import 'dart:uri';
6 import 'parser_helper.dart'; 6 import 'parser_helper.dart';
7 import 'mock_compiler.dart'; 7 import 'mock_compiler.dart';
8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; 8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart';
9 9
10 testUnparse(String statement) { 10 testUnparse(String statement) {
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 testUnparseMemberAndAsMemberOfFoo( 280 testUnparseMemberAndAsMemberOfFoo(
281 "external const factory Foo() = prefix.Bar<List<T>,T>.baz;"); 281 "external const factory Foo() = prefix.Bar<List<T>,T>.baz;");
282 } 282 }
283 283
284 testClassDeclarations() { 284 testClassDeclarations() {
285 testUnparseTopLevelWithMetadata('class Foo{}'); 285 testUnparseTopLevelWithMetadata('class Foo{}');
286 testUnparseTopLevelWithMetadata('abstract class Foo{}'); 286 testUnparseTopLevelWithMetadata('abstract class Foo{}');
287 testUnparseTopLevelWithMetadata('class Fisk{operator-(x){}}'); 287 testUnparseTopLevelWithMetadata('class Fisk{operator-(x){}}');
288 } 288 }
289 289
290 testUnparseParameters(List<String> variableDeclarations) {
291 var sb = new StringBuffer();
292 sb.add('Constructor(');
293 int index = 0;
294 for (String variableDeclaration in variableDeclarations) {
295 if (index != 0) {
296 sb.add(', ');
297 }
298 sb.add(variableDeclaration);
299 index++;
300 }
301 sb.add(');');
302
303 FunctionExpression node = parseMember(sb.toString());
304 index = 0;
305 for (VariableDefinitions parameter in node.parameters.nodes) {
306 Expect.equals(variableDeclarations[index], unparse(parameter));
307 index++;
308 }
309
310 }
311
312 testParameters() {
313 testUnparseParameters(
314 ["foo", "bar=0", "int baz", "int boz=0"]);
315 testUnparseParameters(
316 ["this.foo", "this.bar=0", "int this.baz", "int this.boz=0"]);
317 testUnparseParameters(
318 ["foo()", "void bar()", "int baz(a)", "int boz(int a,int b)=null"]);
319 testUnparseParameters(
320 ["this.foo()", "void this.bar()",
ahe 2013/01/21 11:14:08 If this doesn't work, comment it out.
321 "int this.baz(a)", "int this.boz(int a,int b)=null"]);
322 }
323
290 main() { 324 main() {
291 testSignedConstants(); 325 testSignedConstants();
292 testGenericTypes(); 326 testGenericTypes();
293 testForLoop(); 327 testForLoop();
294 testEmptyList(); 328 testEmptyList();
295 testClosure(); 329 testClosure();
296 testIndexedOperatorDecl(); 330 testIndexedOperatorDecl();
297 testNativeMethods(); 331 testNativeMethods();
298 testPrefixIncrements(); 332 testPrefixIncrements();
299 testConstModifier(); 333 testConstModifier();
300 testSimpleObjectInstantiation(); 334 testSimpleObjectInstantiation();
301 testLibraryName(); 335 testLibraryName();
302 testImport(); 336 testImport();
303 testExport(); 337 testExport();
304 testPart(); 338 testPart();
305 testPartOf(); 339 testPartOf();
306 testCombinators(); 340 testCombinators();
307 testRedirectingFactoryConstructors(); 341 testRedirectingFactoryConstructors();
308 testClassDeclarations(); 342 testClassDeclarations();
343 testParameters();
309 } 344 }
OLDNEW
« tests/compiler/dart2js/dart2js.status ('K') | « tests/compiler/dart2js/dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698