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

Side by Side Diff: tests/compiler/dart2js/duplicate_library_test.dart

Issue 1314833003: Shared commandline flags. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 3 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
« no previous file with comments | « tests/compiler/dart2js/bad_loop_test.dart ('k') | tests/compiler/dart2js/frontend_checker.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/diagnostics/messages.dart' show MessageKind; 12 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
12 import 'memory_compiler.dart'; 13 import 'memory_compiler.dart';
13 14
14 void check(String kind, 15 void check(String kind,
15 Iterable<DiagnosticMessage> messages, 16 Iterable<DiagnosticMessage> messages,
16 List<MessageKind> expectedMessageKinds) { 17 List<MessageKind> expectedMessageKinds) {
17 Expect.equals(messages.length, expectedMessageKinds.length, 18 Expect.equals(messages.length, expectedMessageKinds.length,
18 "Unexpected $kind count: $messages"); 19 "Unexpected $kind count: $messages");
19 int i = 0; 20 int i = 0;
20 messages.forEach((DiagnosticMessage message) { 21 messages.forEach((DiagnosticMessage message) {
21 Expect.equals(expectedMessageKinds[i++], message.message.kind); 22 Expect.equals(expectedMessageKinds[i++], message.message.kind);
22 }); 23 });
23 } 24 }
24 25
25 Future test(Map<String, String> source, 26 Future test(Map<String, String> source,
26 {List<MessageKind> warnings: const <MessageKind>[], 27 {List<MessageKind> warnings: const <MessageKind>[],
27 List<MessageKind> hints: const <MessageKind>[]}) async { 28 List<MessageKind> hints: const <MessageKind>[]}) async {
28 DiagnosticCollector collector = new DiagnosticCollector(); 29 DiagnosticCollector collector = new DiagnosticCollector();
29 await runCompiler( 30 await runCompiler(
30 memorySourceFiles: source, 31 memorySourceFiles: source,
31 diagnosticHandler: collector, 32 diagnosticHandler: collector,
32 showDiagnostics: true, 33 showDiagnostics: true,
33 options: ['--analyze-only', '--analyze-all'], 34 options: [Flags.analyzeOnly, Flags.analyzeAll],
34 packageRoot: Uri.parse('memory:pkg/')); 35 packageRoot: Uri.parse('memory:pkg/'));
35 36
36 Expect.isTrue(collector.errors.isEmpty); 37 Expect.isTrue(collector.errors.isEmpty);
37 check('warning', collector.warnings, warnings); 38 check('warning', collector.warnings, warnings);
38 check('hint', collector.hints, hints); 39 check('hint', collector.hints, hints);
39 Expect.isTrue(collector.infos.isEmpty); 40 Expect.isTrue(collector.infos.isEmpty);
40 } 41 }
41 42
42 void main() { 43 void main() {
43 asyncTest(runTests); 44 asyncTest(runTests);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 'foo.dart': """ 135 'foo.dart': """
135 library lib; 136 library lib;
136 """, 137 """,
137 'bar.dart': """ 138 'bar.dart': """
138 library lib; 139 library lib;
139 """}, 140 """},
140 warnings: [MessageKind.DUPLICATED_LIBRARY_NAME, 141 warnings: [MessageKind.DUPLICATED_LIBRARY_NAME,
141 MessageKind.DUPLICATED_LIBRARY_NAME]); 142 MessageKind.DUPLICATED_LIBRARY_NAME]);
142 } 143 }
143 144
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/bad_loop_test.dart ('k') | tests/compiler/dart2js/frontend_checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698