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

Side by Side Diff: tests/compiler/dart2js/mirrors/mirrors_reader_test.dart

Issue 1562023002: Add test of unittests. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 4 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Test that everything reachable from a [MirrorSystem] can be accessed. 5 // Test that everything reachable from a [MirrorSystem] can be accessed.
6 6
7 library test.mirrors.reader; 7 library test.mirrors.reader;
8 8
9 import "dart:mirrors" hide SourceLocation; 9 import "dart:mirrors" hide SourceLocation;
10 10
11 import "package:async_helper/async_helper.dart"; 11 import "package:async_helper/async_helper.dart";
12 12
13 import "mirrors_test_helper.dart"; 13 import "mirrors_test_helper.dart";
14 import "../../../lib/mirrors/mirrors_reader.dart"; 14 import "../../../lib/mirrors/mirrors_reader.dart";
15 import "package:compiler/src/diagnostics/spannable.dart"; 15 import "package:compiler/src/diagnostics/spannable.dart";
16 import "package:compiler/src/mirrors/dart2js_mirrors.dart"; 16 import "package:compiler/src/mirrors/dart2js_mirrors.dart";
17 import "package:compiler/src/mirrors/source_mirrors.dart"; 17 import "package:compiler/src/mirrors/source_mirrors.dart";
18 18
19 class SourceMirrorsReader extends MirrorsReader { 19 class SourceMirrorsReader extends MirrorsReader {
20 final Dart2JsMirrorSystem mirrorSystem; 20 final Dart2JsMirrorSystem mirrorSystem;
21 21
22 SourceMirrorsReader(this.mirrorSystem, 22 SourceMirrorsReader(this.mirrorSystem,
23 {bool verbose: false, bool includeStackTrace: false}) 23 {bool verbose: false, bool includeStackTrace: false})
24 : super(verbose: verbose, includeStackTrace: includeStackTrace); 24 : super(verbose: verbose, includeStackTrace: includeStackTrace);
25 25
26 evaluate(f()) { 26 evaluate(f()) {
27 try { 27 try {
28 return f(); 28 return f();
29 } on SpannableAssertionFailure catch (e) { 29 } on SpannableAssertionFailure catch (e) {
30 mirrorSystem.compiler.reportAssertionFailure(e); 30 var reporter = mirrorSystem.compiler.reporter;
31 reporter.reportAssertionFailure(e);
31 rethrow; 32 rethrow;
32 } 33 }
33 } 34 }
34 35
35 visitMirror(Mirror mirror) { 36 visitMirror(Mirror mirror) {
36 if (mirror is CombinatorMirror) { 37 if (mirror is CombinatorMirror) {
37 visitCombinatorMirror(mirror); 38 visitCombinatorMirror(mirror);
38 } else if (mirror is LibraryDependencyMirror) { 39 } else if (mirror is LibraryDependencyMirror) {
39 visitLibraryDependencyMirror(mirror); 40 visitLibraryDependencyMirror(mirror);
40 } else if (mirror is CommentInstanceMirror) { 41 } else if (mirror is CommentInstanceMirror) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 133
133 main(List<String> arguments) { 134 main(List<String> arguments) {
134 asyncTest(() => analyzeUri(Uri.parse('dart:core')). 135 asyncTest(() => analyzeUri(Uri.parse('dart:core')).
135 then((MirrorSystem mirrors) { 136 then((MirrorSystem mirrors) {
136 MirrorsReader reader = new SourceMirrorsReader(mirrors, 137 MirrorsReader reader = new SourceMirrorsReader(mirrors,
137 verbose: arguments.contains('-v'), 138 verbose: arguments.contains('-v'),
138 includeStackTrace: arguments.contains('-s')); 139 includeStackTrace: arguments.contains('-s'));
139 reader.checkMirrorSystem(mirrors); 140 reader.checkMirrorSystem(mirrors);
140 })); 141 }));
141 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698