| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 7 | 7 |
| 8 import "memory_compiler.dart"; | 8 import "memory_compiler.dart"; |
| 9 | 9 |
| 10 runTest(String source, String categories, int expectedErrors) async { | 10 runTest(String source, String categories, int expectedErrors) async { |
| 11 var collector = new DiagnosticCollector(); | 11 var collector = new DiagnosticCollector(); |
| 12 await runCompiler( | 12 await runCompiler( |
| 13 memorySourceFiles: {"main.dart": source}, | 13 memorySourceFiles: {"main.dart": source}, |
| 14 options: ["--categories=$categories"], | 14 options: ["--categories=$categories"], |
| 15 diagnosticHandler: collector); | 15 diagnosticHandler: collector); |
| 16 Expect.equals(expectedErrors, collector.errors.length); | 16 Expect.equals(expectedErrors, collector.errors.length); |
| 17 Expect.equals(0, collector.warnings.length); | 17 Expect.equals(0, collector.warnings.length); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void main() { | 20 void main() { |
| 21 asyncTest(() async { | 21 asyncTest(() async { |
| 22 await runTest("import 'dart:async'; main() {}", "Embedded", 1); | |
| 23 await runTest("import 'dart:async'; main() {}", "Client", 0); | 22 await runTest("import 'dart:async'; main() {}", "Client", 0); |
| 24 await runTest("import 'dart:async'; main() {}", "Server", 0); | 23 await runTest("import 'dart:async'; main() {}", "Server", 0); |
| 25 await runTest("import 'dart:html'; main() {}", "Embedded", 1); | |
| 26 await runTest("import 'dart:html'; main() {}", "Client", 0); | 24 await runTest("import 'dart:html'; main() {}", "Client", 0); |
| 27 await runTest("import 'dart:html'; main() {}", "Server", 1); | 25 await runTest("import 'dart:html'; main() {}", "Server", 1); |
| 28 await runTest("import 'dart:io'; main() {}", "Embedded", 1); | |
| 29 await runTest("import 'dart:io'; main() {}", "Client", 1); | 26 await runTest("import 'dart:io'; main() {}", "Client", 1); |
| 30 await runTest("import 'dart:io'; main() {}", "Server", 0); | 27 await runTest("import 'dart:io'; main() {}", "Server", 0); |
| 31 await runTest("import 'dart:_internal'; main() {}", "Embedded", 2); | 28 await runTest("import 'dart:_internal'; main() {}", "Client", 1); |
| 32 await runTest("import 'dart:_internal'; main() {}", "Client", 2); | 29 await runTest("import 'dart:_internal'; main() {}", "Server", 1); |
| 33 await runTest("import 'dart:_internal'; main() {}", "Server", 2); | |
| 34 }); | 30 }); |
| 35 } | 31 } |
| OLD | NEW |