| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 duplicate library names result in different messages depending | 5 // Test that duplicate library names result in different messages depending |
| 6 // on whether the libraries are based on the same resource. | 6 // on whether the libraries are based on the same resource. |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
| 11 import 'package:compiler/src/commandline_options.dart'; | 11 import 'package:compiler/src/commandline_options.dart'; |
| 12 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind; | 12 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind; |
| 13 import 'memory_compiler.dart'; | 13 import 'memory_compiler.dart'; |
| 14 | 14 |
| 15 void check(String kind, | 15 void check(String kind, |
| 16 Iterable<DiagnosticMessage> messages, | 16 Iterable<CollectedMessage> messages, |
| 17 List<MessageKind> expectedMessageKinds) { | 17 List<MessageKind> expectedMessageKinds) { |
| 18 Expect.equals(messages.length, expectedMessageKinds.length, | 18 Expect.equals(messages.length, expectedMessageKinds.length, |
| 19 "Unexpected $kind count: $messages"); | 19 "Unexpected $kind count: $messages"); |
| 20 int i = 0; | 20 int i = 0; |
| 21 messages.forEach((DiagnosticMessage message) { | 21 messages.forEach((CollectedMessage message) { |
| 22 Expect.equals(expectedMessageKinds[i++], message.message.kind); | 22 Expect.equals(expectedMessageKinds[i++], message.messageKind); |
| 23 }); | 23 }); |
| 24 } | 24 } |
| 25 | 25 |
| 26 Future test(Map<String, String> source, | 26 Future test(Map<String, String> source, |
| 27 {List<MessageKind> warnings: const <MessageKind>[], | 27 {List<MessageKind> warnings: const <MessageKind>[], |
| 28 List<MessageKind> hints: const <MessageKind>[]}) async { | 28 List<MessageKind> hints: const <MessageKind>[]}) async { |
| 29 DiagnosticCollector collector = new DiagnosticCollector(); | 29 DiagnosticCollector collector = new DiagnosticCollector(); |
| 30 await runCompiler( | 30 await runCompiler( |
| 31 memorySourceFiles: source, | 31 memorySourceFiles: source, |
| 32 diagnosticHandler: collector, | 32 diagnosticHandler: collector, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 'foo.dart': """ | 135 'foo.dart': """ |
| 136 library lib; | 136 library lib; |
| 137 """, | 137 """, |
| 138 'bar.dart': """ | 138 'bar.dart': """ |
| 139 library lib; | 139 library lib; |
| 140 """}, | 140 """}, |
| 141 warnings: [MessageKind.DUPLICATED_LIBRARY_NAME, | 141 warnings: [MessageKind.DUPLICATED_LIBRARY_NAME, |
| 142 MessageKind.DUPLICATED_LIBRARY_NAME]); | 142 MessageKind.DUPLICATED_LIBRARY_NAME]); |
| 143 } | 143 } |
| 144 | 144 |
| OLD | NEW |