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

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

Issue 1205373002: Translate package URIs to resource URIs for diagnostics. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Use resourceUri instead of readableUri in source spans. Created 5 years, 6 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/package_root_test.dart ('k') | no next file » | 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 the '--show-package-warnings' option works as intended. 5 // Test that the '--show-package-warnings' option works as intended.
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 import 'memory_compiler.dart'; 10 import 'memory_compiler.dart';
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } else { 62 } else {
63 compiler.librariesToAnalyzeWhenRun = entryPoints; 63 compiler.librariesToAnalyzeWhenRun = entryPoints;
64 } 64 }
65 asyncTest(() => compiler.run(mainUri).then((_) { 65 asyncTest(() => compiler.run(mainUri).then((_) {
66 print('=================================================================='); 66 print('==================================================================');
67 print('test: $entryPoints showPackageWarnings=$showPackageWarnings'); 67 print('test: $entryPoints showPackageWarnings=$showPackageWarnings');
68 Expect.equals(0, collector.errors.length, 68 Expect.equals(0, collector.errors.length,
69 'Unexpected errors: ${collector.errors}'); 69 'Unexpected errors: ${collector.errors}');
70 Expect.equals(warnings, collector.warnings.length, 70 Expect.equals(warnings, collector.warnings.length,
71 'Unexpected warnings: ${collector.warnings}'); 71 'Unexpected warnings: ${collector.warnings}');
72 checkUriSchemes(collector.warnings);
72 Expect.equals(hints, collector.hints.length, 73 Expect.equals(hints, collector.hints.length,
73 'Unexpected hints: ${collector.hints}'); 74 'Unexpected hints: ${collector.hints}');
75 checkUriSchemes(collector.hints);
74 Expect.equals(infos, collector.infos.length, 76 Expect.equals(infos, collector.infos.length,
75 'Unexpected infos: ${collector.infos}'); 77 'Unexpected infos: ${collector.infos}');
78 checkUriSchemes(collector.infos);
76 print('=================================================================='); 79 print('==================================================================');
77 })); 80 }));
78 } 81 }
79 82
83 void checkUriSchemes(Iterable<DiagnosticMessage> messages) {
84 for (DiagnosticMessage message in messages) {
85 if (message.uri != null) {
86 Expect.notEquals('package', message.uri.scheme,
87 "Unexpected package uri `${message.uri}` in message: $message");
88 }
89 }
90 }
91
80 void main() { 92 void main() {
81 test([Uri.parse('memory:main.dart')], 93 test([Uri.parse('memory:main.dart')],
82 showPackageWarnings: true, 94 showPackageWarnings: true,
83 // From error.dart, package:pkg_error1 and package:pkg_error2: 95 // From error.dart, package:pkg_error1 and package:pkg_error2:
84 warnings: 3, hints: 3, infos: 3); 96 warnings: 3, hints: 3, infos: 3);
85 test([Uri.parse('memory:main.dart')], 97 test([Uri.parse('memory:main.dart')],
86 showPackageWarnings: false, 98 showPackageWarnings: false,
87 // From error.dart only: 99 // From error.dart only:
88 warnings: 1, hints: 1 + 2 /* from summary */, infos: 1); 100 warnings: 1, hints: 1 + 2 /* from summary */, infos: 1);
89 test([Uri.parse('package:pkg_error1/pkg_error1.dart')], 101 test([Uri.parse('package:pkg_error1/pkg_error1.dart')],
90 showPackageWarnings: true, 102 showPackageWarnings: true,
91 // From package:pkg_error1 and package:pkg_error2: 103 // From package:pkg_error1 and package:pkg_error2:
92 warnings: 2, hints: 2, infos: 2); 104 warnings: 2, hints: 2, infos: 2);
93 test([Uri.parse('package:pkg_error1/pkg_error1.dart')], 105 test([Uri.parse('package:pkg_error1/pkg_error1.dart')],
94 showPackageWarnings: false, 106 showPackageWarnings: false,
95 // From package:pkg_error1/pkg_error1.dart only: 107 // From package:pkg_error1/pkg_error1.dart only:
96 warnings: 1, hints: 1 + 1 /* from summary */, infos: 1); 108 warnings: 1, hints: 1 + 1 /* from summary */, infos: 1);
97 test([Uri.parse('package:pkg_noerror/pkg_noerror.dart')], 109 test([Uri.parse('package:pkg_noerror/pkg_noerror.dart')],
98 showPackageWarnings: true, 110 showPackageWarnings: true,
99 // From package:pkg_error1 and package:pkg_error2: 111 // From package:pkg_error1 and package:pkg_error2:
100 warnings: 2, hints: 2, infos: 2); 112 warnings: 2, hints: 2, infos: 2);
101 test([Uri.parse('package:pkg_noerror/pkg_noerror.dart')], 113 test([Uri.parse('package:pkg_noerror/pkg_noerror.dart')],
102 showPackageWarnings: false, 114 showPackageWarnings: false,
103 hints: 2 /* from summary */); 115 hints: 2 /* from summary */);
104 } 116 }
105 117
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/package_root_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698