| Index: tests/compiler/dart2js/hide_package_warnings_test.dart
 | 
| diff --git a/tests/compiler/dart2js/hide_package_warnings_test.dart b/tests/compiler/dart2js/hide_package_warnings_test.dart
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..639eef8806ec23a070d5bd489803ec42668ed3a9
 | 
| --- /dev/null
 | 
| +++ b/tests/compiler/dart2js/hide_package_warnings_test.dart
 | 
| @@ -0,0 +1,104 @@
 | 
| +// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
 | 
| +// for details. All rights reserved. Use of this source code is governed by a
 | 
| +// BSD-style license that can be found in the LICENSE file.
 | 
| +
 | 
| +// Test that the '--hide-package-warnings' option works as intended.
 | 
| +
 | 
| +import 'package:async_helper/async_helper.dart';
 | 
| +import 'package:expect/expect.dart';
 | 
| +
 | 
| +import 'memory_compiler.dart';
 | 
| +
 | 
| +/// Error code that creates 1 warning, 1 hint, and 1 info.
 | 
| +const ERROR_CODE = """
 | 
| +m(Object o) {
 | 
| +  if (o is String) {
 | 
| +    o = o.length;
 | 
| +  }
 | 
| +}""";
 | 
| +
 | 
| +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';               
 | 
| +""",
 | 
| +
 | 
| +  '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""",
 | 
| +
 | 
| +  'pkg/pkg_error2/pkg_error2.dart': """
 | 
| +import 'package:pkg_error1/pkg_error1.dart';
 | 
| +import 'package:pkg_noerror/pkg_noerror.dart';
 | 
| +$ERROR_CODE""",
 | 
| +
 | 
| +  'pkg/pkg_noerror/pkg_noerror.dart': """
 | 
| +import 'package:pkg_error1/pkg_error1.dart';
 | 
| +import 'package:pkg_error2/pkg_error2.dart';
 | 
| +"""};
 | 
| +
 | 
| +void test(List<Uri> entryPoints,
 | 
| +          {bool hidePackageWarnings: false,
 | 
| +           int warnings: 0,
 | 
| +           int hints: 0,
 | 
| +           int infos: 0}) {
 | 
| +  var options = ['--analyze-only', '--analyze-all'];
 | 
| +  if (hidePackageWarnings) {
 | 
| +    options.add('--hide-package-warnings');
 | 
| +  }
 | 
| +  var collector = new DiagnosticCollector();
 | 
| +  var compiler = compilerFor(SOURCE,
 | 
| +                             options: options,
 | 
| +                             packageRoot: Uri.parse('memory:pkg/'),
 | 
| +                             diagnosticHandler: collector);
 | 
| +  Uri mainUri = null;
 | 
| +  if (entryPoints.length == 1) {
 | 
| +    mainUri = entryPoints[0];
 | 
| +  } else {
 | 
| +    compiler.librariesToAnalyzeWhenRun = entryPoints;
 | 
| +  }
 | 
| +  asyncTest(() => compiler.run(mainUri).then((_) {
 | 
| +    print('==================================================================');
 | 
| +    print('test: $entryPoints hidePackageWarnings=$hidePackageWarnings');
 | 
| +    Expect.equals(0, collector.errors.length,
 | 
| +                  'Unexpected errors: ${collector.errors}');
 | 
| +    Expect.equals(warnings, collector.warnings.length,
 | 
| +                  'Unexpected warnings: ${collector.warnings}');
 | 
| +    Expect.equals(hints, collector.hints.length,
 | 
| +                  'Unexpected hints: ${collector.hints}');
 | 
| +    Expect.equals(infos, collector.infos.length,
 | 
| +                  'Unexpected infos: ${collector.infos}');
 | 
| +    print('==================================================================');
 | 
| +  }));
 | 
| +}
 | 
| +
 | 
| +void main() {
 | 
| +  test([Uri.parse('memory:main.dart')],
 | 
| +       hidePackageWarnings: false,
 | 
| +       // From error.dart, package:pkg_error1 and package:pkg_error2:
 | 
| +       warnings: 3, hints: 3, infos: 3);
 | 
| +  test([Uri.parse('memory:main.dart')],
 | 
| +       hidePackageWarnings: true,
 | 
| +       // From error.dart only:
 | 
| +       warnings: 1, hints: 1, infos: 1);
 | 
| +  test([Uri.parse('package:pkg_error1/pkg_error1.dart')],
 | 
| +       hidePackageWarnings: false,
 | 
| +       // From package:pkg_error1 and package:pkg_error2:
 | 
| +       warnings: 2, hints: 2, infos: 2);
 | 
| +  test([Uri.parse('package:pkg_error1/pkg_error1.dart')],
 | 
| +       hidePackageWarnings: true,
 | 
| +       // From package:pkg_error1/pkg_error1.dart only:
 | 
| +       warnings: 1, hints: 1, infos: 1);
 | 
| +  test([Uri.parse('package:pkg_noerror/pkg_noerror.dart')],
 | 
| +       hidePackageWarnings: false,
 | 
| +       // From package:pkg_error1 and package:pkg_error2:
 | 
| +       warnings: 2, hints: 2, infos: 2);
 | 
| +  test([Uri.parse('package:pkg_noerror/pkg_noerror.dart')],
 | 
| +       hidePackageWarnings: true);
 | 
| +}
 | 
| +
 | 
| 
 |