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

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

Issue 326913002: Make dart2js unittests async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 6 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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:async'; 6 import 'dart:async';
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import 'mock_compiler.dart'; 8 import 'mock_compiler.dart';
9 import '../../../sdk/lib/_internal/compiler/compiler.dart'; 9 import '../../../sdk/lib/_internal/compiler/compiler.dart';
10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l eg; 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l eg;
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 new PlaceholderCollector(compiler, new Set<String>(), new DynoMap(compiler)) 456 new PlaceholderCollector(compiler, new Set<String>(), new DynoMap(compiler))
457 ..collect(element); 457 ..collect(element);
458 458
459 testLocalFunctionPlaceholder() { 459 testLocalFunctionPlaceholder() {
460 var src = ''' 460 var src = '''
461 main() { 461 main() {
462 function localfoo() {} 462 function localfoo() {}
463 localfoo(); 463 localfoo();
464 } 464 }
465 '''; 465 ''';
466 MockCompiler compiler = new MockCompiler(emitJavaScript: false); 466 MockCompiler compiler = new MockCompiler.internal(emitJavaScript: false);
467 assert(compiler.backend is DartBackend); 467 asyncTest(() => compiler.init().then((_) {
468 compiler.parseScript(src); 468 assert(compiler.backend is DartBackend);
469 FunctionElement mainElement = compiler.mainApp.find(leg.Compiler.MAIN); 469 compiler.parseScript(src);
470 compiler.processQueue(compiler.enqueuer.resolution, mainElement); 470 FunctionElement mainElement = compiler.mainApp.find(leg.Compiler.MAIN);
471 PlaceholderCollector collector = collectPlaceholders(compiler, mainElement); 471 compiler.processQueue(compiler.enqueuer.resolution, mainElement);
472 FunctionExpression mainNode = mainElement.parseNode(compiler); 472 PlaceholderCollector collector = collectPlaceholders(compiler, mainElement);
473 Block body = mainNode.body; 473 FunctionExpression mainNode = mainElement.parseNode(compiler);
474 FunctionDeclaration functionDeclaration = body.statements.nodes.head; 474 Block body = mainNode.body;
475 FunctionExpression fooNode = functionDeclaration.function; 475 FunctionDeclaration functionDeclaration = body.statements.nodes.head;
476 LocalPlaceholder fooPlaceholder = 476 FunctionExpression fooNode = functionDeclaration.function;
477 collector.functionScopes[mainElement].localPlaceholders.first; 477 LocalPlaceholder fooPlaceholder =
478 Expect.isTrue(fooPlaceholder.nodes.contains(fooNode.name)); 478 collector.functionScopes[mainElement].localPlaceholders.first;
479 Expect.isTrue(fooPlaceholder.nodes.contains(fooNode.name));
480 }));
479 } 481 }
480 482
481 testTypeVariablesAreRenamed() { 483 testTypeVariablesAreRenamed() {
482 // Somewhat a hack: we require all the references of the identifier 484 // Somewhat a hack: we require all the references of the identifier
483 // to be renamed in the same way for the whole library. Hence 485 // to be renamed in the same way for the whole library. Hence
484 // if we have a class and type variable with the same name, they 486 // if we have a class and type variable with the same name, they
485 // both should be renamed. 487 // both should be renamed.
486 var librarySrc = ''' 488 var librarySrc = '''
487 library mylib; 489 library mylib;
488 typedef void MyFunction<T extends num>(T arg); 490 typedef void MyFunction<T extends num>(T arg);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 testStaticAccessIoLib(); 739 testStaticAccessIoLib();
738 testLocalFunctionPlaceholder(); 740 testLocalFunctionPlaceholder();
739 testMinification(); 741 testMinification();
740 testClosureLocalsMinified(); 742 testClosureLocalsMinified();
741 testParametersMinified(); 743 testParametersMinified();
742 testDeclarationTypePlaceholders(); 744 testDeclarationTypePlaceholders();
743 testPlatformLibraryMemberNamesAreFixed(); 745 testPlatformLibraryMemberNamesAreFixed();
744 testConflictsWithCoreLib(); 746 testConflictsWithCoreLib();
745 testUnresolvedNamedConstructor(); 747 testUnresolvedNamedConstructor();
746 } 748 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/cpa_inference_test.dart ('k') | tests/compiler/dart2js/dead_phi_eliminator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698