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

Unified Diff: tests/compiler/dart2js/mirrors_metadata_test.dart

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/mirrors_lookup_test.dart ('k') | tests/compiler/dart2js/mirrors_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mirrors_metadata_test.dart
diff --git a/tests/compiler/dart2js/mirrors_metadata_test.dart b/tests/compiler/dart2js/mirrors_metadata_test.dart
index 22b0c8144ac7c8ddec2dc62a799dfc5367be838c..1e3307cc4cff67ba5b89443fd7a60c95b5fd9266 100644
--- a/tests/compiler/dart2js/mirrors_metadata_test.dart
+++ b/tests/compiler/dart2js/mirrors_metadata_test.dart
@@ -4,6 +4,7 @@
import 'package:expect/expect.dart';
import 'dart:async';
+import "package:async_helper/async_helper.dart";
import 'dart:io';
import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
@@ -14,15 +15,16 @@ import 'mock_compiler.dart';
const String SOURCE = 'source';
Uri SOURCE_URI = new Uri(scheme: SOURCE, path: SOURCE);
-MirrorSystem createMirrorSystem(String source) {
+Future<MirrorSystem> createMirrorSystem(String source) {
MockCompiler compiler = new MockCompiler(
analyzeOnly: true,
analyzeAll: true,
preserveComments: true);
- compiler.registerSource(SOURCE_URI, source);
- compiler.librariesToAnalyzeWhenRun = <Uri>[SOURCE_URI];
- compiler.runCompiler(null);
- return new Dart2JsMirrorSystem(compiler);
+ compiler.registerSource(SOURCE_URI, source);
+ compiler.librariesToAnalyzeWhenRun = <Uri>[SOURCE_URI];
+ return compiler.runCompiler(null).then((_) {
+ return new Dart2JsMirrorSystem(compiler);
+ });
}
void validateDeclarationComment(String code,
@@ -30,21 +32,22 @@ void validateDeclarationComment(String code,
String trimmedText,
bool isDocComment,
List<String> declarationNames) {
- MirrorSystem mirrors = createMirrorSystem(code);
- LibraryMirror library = mirrors.libraries[SOURCE_URI];
- Expect.isNotNull(library);
- for (String declarationName in declarationNames) {
- DeclarationMirror declaration = library.members[declarationName];
- Expect.isNotNull(declaration);
- List<InstanceMirror> metadata = declaration.metadata;
- Expect.isNotNull(metadata);
- Expect.equals(1, metadata.length);
- Expect.isTrue(metadata[0] is CommentInstanceMirror);
- CommentInstanceMirror commentMetadata = metadata[0];
- Expect.equals(text, commentMetadata.text);
- Expect.equals(trimmedText, commentMetadata.trimmedText);
- Expect.equals(isDocComment, commentMetadata.isDocComment);
- }
+ asyncTest(() => createMirrorSystem(code).then((mirrors) {
+ LibraryMirror library = mirrors.libraries[SOURCE_URI];
+ Expect.isNotNull(library);
+ for (String declarationName in declarationNames) {
+ DeclarationMirror declaration = library.members[declarationName];
+ Expect.isNotNull(declaration);
+ List<InstanceMirror> metadata = declaration.metadata;
+ Expect.isNotNull(metadata);
+ Expect.equals(1, metadata.length);
+ Expect.isTrue(metadata[0] is CommentInstanceMirror);
+ CommentInstanceMirror commentMetadata = metadata[0];
+ Expect.equals(text, commentMetadata.text);
+ Expect.equals(trimmedText, commentMetadata.trimmedText);
+ Expect.equals(isDocComment, commentMetadata.isDocComment);
+ }
+ }));
}
void testDeclarationComment(String declaration, List<String> declarationNames) {
« no previous file with comments | « tests/compiler/dart2js/mirrors_lookup_test.dart ('k') | tests/compiler/dart2js/mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698