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