OLD | NEW |
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 "package:async_helper/async_helper.dart"; |
6 import 'dart:async'; | 7 import 'dart:async'; |
7 import "package:async_helper/async_helper.dart"; | 8 import 'mirror_system_helper.dart'; |
8 import 'dart:io'; | |
9 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; | |
10 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
; | |
11 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirro
r.dart'; | |
12 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; | |
13 import 'mock_compiler.dart'; | |
14 | |
15 const String SOURCE = 'source'; | |
16 Uri SOURCE_URI = new Uri(scheme: SOURCE, path: SOURCE); | |
17 | |
18 Future<MirrorSystem> createMirrorSystem(String source) { | |
19 MockCompiler compiler = new MockCompiler( | |
20 analyzeOnly: true, | |
21 analyzeAll: true, | |
22 preserveComments: true); | |
23 compiler.registerSource(SOURCE_URI, source); | |
24 compiler.librariesToAnalyzeWhenRun = <Uri>[SOURCE_URI]; | |
25 return compiler.runCompiler(null).then((_) { | |
26 return new Dart2JsMirrorSystem(compiler); | |
27 }); | |
28 } | |
29 | 9 |
30 void validateDeclarationComment(String code, | 10 void validateDeclarationComment(String code, |
31 String text, | 11 String text, |
32 String trimmedText, | 12 String trimmedText, |
33 bool isDocComment, | 13 bool isDocComment, |
34 List<String> declarationNames) { | 14 List<String> declarationNames) { |
35 asyncTest(() => createMirrorSystem(code).then((mirrors) { | 15 asyncTest(() => createMirrorSystem(code).then((mirrors) { |
36 LibraryMirror library = mirrors.libraries[SOURCE_URI]; | 16 LibraryMirror library = mirrors.libraries[SOURCE_URI]; |
37 Expect.isNotNull(library); | 17 Expect.isNotNull(library); |
38 for (String declarationName in declarationNames) { | 18 for (String declarationName in declarationNames) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 testDeclarationComment('final int field = 0;', ['field']); | 59 testDeclarationComment('final int field = 0;', ['field']); |
80 testDeclarationComment('final field1 = 0, field2 = 0;', ['field1', 'field2']); | 60 testDeclarationComment('final field1 = 0, field2 = 0;', ['field1', 'field2']); |
81 testDeclarationComment('final int field1 = 0, field2 = 0;', | 61 testDeclarationComment('final int field1 = 0, field2 = 0;', |
82 ['field1', 'field2']); | 62 ['field1', 'field2']); |
83 testDeclarationComment('const field = 0;', ['field']); | 63 testDeclarationComment('const field = 0;', ['field']); |
84 testDeclarationComment('const int field = 0;', ['field']); | 64 testDeclarationComment('const int field = 0;', ['field']); |
85 testDeclarationComment('const field1 = 0, field2 = 0;', ['field1', 'field2']); | 65 testDeclarationComment('const field1 = 0, field2 = 0;', ['field1', 'field2']); |
86 testDeclarationComment('const int field1 = 0, field2 = 0;', | 66 testDeclarationComment('const int field1 = 0, field2 = 0;', |
87 ['field1', 'field2']); | 67 ['field1', 'field2']); |
88 } | 68 } |
OLD | NEW |