OLD | NEW |
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 | |
6 import 'package:async_helper/async_helper.dart'; | 5 import 'package:async_helper/async_helper.dart'; |
7 import 'package:compiler/compiler_new.dart' show Diagnostic; | 6 import 'package:compiler/compiler_new.dart' show Diagnostic; |
8 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
9 import 'memory_compiler.dart'; | 8 import 'memory_compiler.dart'; |
10 | 9 |
11 void main() { | 10 void main() { |
12 DiagnosticCollector collector = new DiagnosticCollector(); | 11 DiagnosticCollector collector = new DiagnosticCollector(); |
13 asyncTest(() async { | 12 asyncTest(() async { |
14 CompilationResult result = await runCompiler( | 13 CompilationResult result = await runCompiler( |
15 memorySourceFiles: MEMORY_SOURCE_FILES, | 14 memorySourceFiles: MEMORY_SOURCE_FILES, |
16 diagnosticHandler: collector, | 15 diagnosticHandler: collector, |
17 options: ['--analyze-all']); | 16 options: ['--analyze-all']); |
18 | 17 |
19 List<String> diagnostics = <String>[]; | 18 List<String> diagnostics = <String>[]; |
20 collector.messages.forEach((CollectedMessage message) { | 19 collector.messages.forEach((CollectedMessage message) { |
21 if (message.kind == Diagnostic.VERBOSE_INFO) return; | 20 if (message.kind == Diagnostic.VERBOSE_INFO) return; |
22 diagnostics.add(message.toString()); | 21 diagnostics.add(message.toString()); |
23 }); | 22 }); |
24 diagnostics.sort(); | 23 diagnostics.sort(); |
25 var expected = [ | 24 var expected = [ |
26 "MessageKind.AMBIGUOUS_LOCATION:" | 25 "MessageKind.AMBIGUOUS_LOCATION:" |
27 "memory:exporter.dart:43:47:'hest' is defined here.:info", | 26 "memory:exporter.dart:43:47:'hest' is defined here.:info", |
28 "MessageKind.AMBIGUOUS_LOCATION:" | 27 "MessageKind.AMBIGUOUS_LOCATION:" |
29 "memory:library.dart:41:45:'hest' is defined here.:info", | 28 "memory:library.dart:41:45:'hest' is defined here.:info", |
30 "MessageKind.DUPLICATE_IMPORT:" | 29 "MessageKind.DUPLICATE_IMPORT:" |
31 "memory:main.dart:86:92:Duplicate import of 'hest'.:warning", | 30 "memory:main.dart:86:92:Duplicate import of 'hest'.:warning", |
32 "MessageKind.IMPORTED_HERE:" | 31 "MessageKind.IMPORTED_HERE:" |
33 "memory:main.dart:0:22:'hest' is imported here.:info", | 32 "memory:main.dart:0:22:'hest' is imported here.:info", |
34 "MessageKind.IMPORTED_HERE:" | 33 "MessageKind.IMPORTED_HERE:" |
35 "memory:main.dart:23:46:'hest' is imported here.:info", | 34 "memory:main.dart:23:46:'hest' is imported here.:info", |
36 ]; | 35 ]; |
37 Expect.listEquals(expected, diagnostics); | 36 Expect.listEquals(expected, diagnostics); |
38 Expect.isTrue(result.isSuccess); | 37 Expect.isTrue(result.isSuccess); |
39 }); | 38 }); |
40 } | 39 } |
41 | 40 |
42 const Map MEMORY_SOURCE_FILES = const { | 41 const Map MEMORY_SOURCE_FILES = const { |
43 'main.dart': """ | 42 'main.dart': """ |
44 import 'library.dart'; | 43 import 'library.dart'; |
45 import 'exporter.dart'; | 44 import 'exporter.dart'; |
(...skipping 15 matching lines...) Expand all Loading... |
61 hest() {} | 60 hest() {} |
62 """, | 61 """, |
63 'exporter.dart': """ | 62 'exporter.dart': """ |
64 library exporter; | 63 library exporter; |
65 | 64 |
66 export 'library.dart'; | 65 export 'library.dart'; |
67 | 66 |
68 hest() {} | 67 hest() {} |
69 """, | 68 """, |
70 }; | 69 }; |
OLD | NEW |