Index: tests/compiler/dart2js/show_package_warnings_test.dart |
diff --git a/tests/compiler/dart2js/show_package_warnings_test.dart b/tests/compiler/dart2js/show_package_warnings_test.dart |
index 6a1aa3f1fc77c5cf5b18650ef7ad654dad7b6f1d..cc05018def2e14930262e90098d64267023568b7 100644 |
--- a/tests/compiler/dart2js/show_package_warnings_test.dart |
+++ b/tests/compiler/dart2js/show_package_warnings_test.dart |
@@ -20,47 +20,81 @@ m(Object o) { |
const SOURCE = const { |
'main.dart': """ |
-import 'package:pkg_error1/pkg_error1.dart'; |
-import 'package:pkg_error2/pkg_error2.dart'; |
-import 'package:pkg_noerror/pkg_noerror.dart'; |
-import 'error.dart'; |
+import 'package:pkg_error1/pkg_error1.dart' as pkg1; |
+import 'package:pkg_error2/pkg_error2.dart' as pkg2; |
+import 'package:pkg_noerror/pkg_noerror.dart' as pkg3; |
+import 'error.dart' as error; |
+ |
+main() { |
+ pkg1.m(null); |
+ pkg2.m(null); |
+ pkg3.m(null); |
+ error.m(null); |
+} |
""", |
'error.dart': ERROR_CODE, |
'pkg/pkg_error1/pkg_error1.dart': """ |
-import 'package:pkg_error2/pkg_error2.dart'; |
-import 'package:pkg_noerror/pkg_noerror.dart'; |
-$ERROR_CODE""", |
+import 'package:pkg_error2/pkg_error2.dart' as pkg2; |
+import 'package:pkg_noerror/pkg_noerror.dart' as pkg3; |
+$ERROR_CODE |
+ |
+main() { |
+ m(null); |
+ pkg2.m(null); |
+ pkg3.m(null); |
+} |
+""", |
'pkg/pkg_error2/pkg_error2.dart': """ |
-import 'package:pkg_error1/pkg_error1.dart'; |
-import 'package:pkg_noerror/pkg_noerror.dart'; |
-$ERROR_CODE""", |
+import 'package:pkg_error1/pkg_error1.dart' as pkg1; |
+import 'package:pkg_noerror/pkg_noerror.dart' as pkg3; |
+$ERROR_CODE |
+ |
+main() { |
+ pkg1.m(null); |
+ m(null); |
+ pkg3.m(null); |
+} |
+""", |
'pkg/pkg_noerror/pkg_noerror.dart': """ |
-import 'package:pkg_error1/pkg_error1.dart'; |
-import 'package:pkg_error2/pkg_error2.dart'; |
+import 'package:pkg_error1/pkg_error1.dart' as pkg1; |
+import 'package:pkg_error2/pkg_error2.dart' as pkg2; |
+m(o) {} |
+ |
+main() { |
+ pkg1.m(null); |
+ m(null); |
+ pkg2.m(null); |
+} |
"""}; |
Future test(Uri entryPoint, |
- {bool showPackageWarnings: false, |
+ {List<String> showPackageWarnings: null, |
int warnings: 0, |
int hints: 0, |
int infos: 0}) async { |
- var options = [Flags.analyzeOnly, Flags.analyzeAll]; |
- if (showPackageWarnings) { |
- options.add(Flags.showPackageWarnings); |
+ var options = [Flags.analyzeOnly]; |
+ if (showPackageWarnings != null) { |
+ if (showPackageWarnings.isEmpty) { |
+ options.add(Flags.showPackageWarnings); |
+ } else { |
+ options.add( |
+ '${Flags.showPackageWarnings}=${showPackageWarnings.join(',')}'); |
+ } |
} |
var collector = new DiagnosticCollector(); |
+ print('=================================================================='); |
+ print('test: $entryPoint showPackageWarnings=$showPackageWarnings'); |
+ print('------------------------------------------------------------------'); |
await runCompiler( |
entryPoint: entryPoint, |
memorySourceFiles: SOURCE, |
options: options, |
packageRoot: Uri.parse('memory:pkg/'), |
diagnosticHandler: collector); |
- print('=================================================================='); |
- print('test: $entryPoint showPackageWarnings=$showPackageWarnings'); |
Expect.equals(0, collector.errors.length, |
'Unexpected errors: ${collector.errors}'); |
Expect.equals(warnings, collector.warnings.length, |
@@ -72,7 +106,6 @@ Future test(Uri entryPoint, |
Expect.equals(infos, collector.infos.length, |
'Unexpected infos: ${collector.infos}'); |
checkUriSchemes(collector.infos); |
- print('=================================================================='); |
} |
void checkUriSchemes(Iterable<CollectedMessage> messages) { |
@@ -88,32 +121,52 @@ void main() { |
asyncTest(() async { |
await test( |
Uri.parse('memory:main.dart'), |
- showPackageWarnings: true, |
+ showPackageWarnings: [], |
+ // From error.dart, package:pkg_error1 and package:pkg_error2: |
+ warnings: 3, hints: 3, infos: 3); |
+ await test( |
+ Uri.parse('memory:main.dart'), |
+ showPackageWarnings: ['pkg_error1'], |
+ // From error.dart and package:pkg_error1: |
+ warnings: 2, hints: 2 + 1 /* from summary */, infos: 2); |
+ await test( |
+ Uri.parse('memory:main.dart'), |
+ showPackageWarnings: ['pkg_error1', 'pkg_error2'], |
// From error.dart, package:pkg_error1 and package:pkg_error2: |
warnings: 3, hints: 3, infos: 3); |
await test( |
Uri.parse('memory:main.dart'), |
- showPackageWarnings: false, |
+ showPackageWarnings: [], |
+ // From error.dart, package:pkg_error1 and package:pkg_error2: |
+ warnings: 3, hints: 3, infos: 3); |
+ await test( |
+ Uri.parse('memory:main.dart'), |
+ showPackageWarnings: null, |
// From error.dart only: |
warnings: 1, hints: 1 + 2 /* from summary */, infos: 1); |
await test( |
Uri.parse('package:pkg_error1/pkg_error1.dart'), |
- showPackageWarnings: true, |
+ showPackageWarnings: [], |
// From package:pkg_error1 and package:pkg_error2: |
warnings: 2, hints: 2, infos: 2); |
await test( |
Uri.parse('package:pkg_error1/pkg_error1.dart'), |
- showPackageWarnings: false, |
+ showPackageWarnings: null, |
// From package:pkg_error1/pkg_error1.dart only: |
warnings: 1, hints: 1 + 1 /* from summary */, infos: 1); |
await test( |
Uri.parse('package:pkg_noerror/pkg_noerror.dart'), |
- showPackageWarnings: true, |
+ showPackageWarnings: [], |
// From package:pkg_error1 and package:pkg_error2: |
warnings: 2, hints: 2, infos: 2); |
await test( |
Uri.parse('package:pkg_noerror/pkg_noerror.dart'), |
- showPackageWarnings: false, |
+ showPackageWarnings: ['pkg_error1'], |
+ // From package:pkg_error1: |
+ warnings: 1, hints: 1 + 1 /* from summary */, infos: 1); |
+ await test( |
+ Uri.parse('package:pkg_noerror/pkg_noerror.dart'), |
+ showPackageWarnings: null, |
hints: 2 /* from summary */); |
}); |
} |