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

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

Issue 1525593002: Introduce benign errors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years 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 | « pkg/compiler/lib/src/compiler.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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that benign error do not prevent compilation.
6
7 import 'memory_compiler.dart';
8
9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/src/compiler.dart';
11 import 'package:compiler/src/diagnostics/messages.dart';
12 import 'package:compiler/src/js_backend/js_backend.dart';
13 import 'package:expect/expect.dart';
14
15 main() {
16 asyncTest(() async {
17 for (MessageKind kind in Compiler.BENIGN_ERRORS) {
18 await testExamples(kind);
19 }
20 });
21 }
22
23 testExamples(MessageKind kind) async {
24 MessageTemplate template = MessageTemplate.TEMPLATES[kind];
25 for (var example in template.examples) {
26 if (example is! Map) {
27 example = {'main.dart': example};
28 }
29 DiagnosticCollector collector = new DiagnosticCollector();
30 CompilationResult result = await runCompiler(
31 memorySourceFiles: example,
32 diagnosticHandler: collector);
33 Expect.isTrue(result.isSuccess);
34 Expect.isTrue(
35 collector.errors.any((message) => message.messageKind == kind));
36 Compiler compiler = result.compiler;
37 JavaScriptBackend backend = compiler.backend;
38 Expect.isNotNull(backend.generatedCode[compiler.mainFunction]);
39 }
40 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698