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 // Test that benign error do not prevent compilation. | 5 // Test that benign error do not prevent compilation. |
6 | 6 |
7 import 'memory_compiler.dart'; | 7 import 'memory_compiler.dart'; |
8 | 8 |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 testExamples(MessageKind kind) async { | 23 testExamples(MessageKind kind) async { |
24 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; | 24 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; |
25 for (var example in template.examples) { | 25 for (var example in template.examples) { |
26 if (example is! Map) { | 26 if (example is! Map) { |
27 example = {'main.dart': example}; | 27 example = {'main.dart': example}; |
28 } | 28 } |
29 DiagnosticCollector collector = new DiagnosticCollector(); | 29 DiagnosticCollector collector = new DiagnosticCollector(); |
30 CompilationResult result = await runCompiler( | 30 CompilationResult result = await runCompiler( |
31 memorySourceFiles: example, | 31 memorySourceFiles: example, diagnosticHandler: collector); |
32 diagnosticHandler: collector); | |
33 Expect.isTrue(result.isSuccess); | 32 Expect.isTrue(result.isSuccess); |
34 Expect.isTrue( | 33 Expect |
35 collector.errors.any((message) => message.messageKind == kind)); | 34 .isTrue(collector.errors.any((message) => message.messageKind == kind)); |
36 Compiler compiler = result.compiler; | 35 Compiler compiler = result.compiler; |
37 JavaScriptBackend backend = compiler.backend; | 36 JavaScriptBackend backend = compiler.backend; |
38 Expect.isNotNull(backend.generatedCode[compiler.mainFunction]); | 37 Expect.isNotNull(backend.generatedCode[compiler.mainFunction]); |
39 } | 38 } |
40 } | 39 } |
OLD | NEW |