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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/benign_error_test.dart
diff --git a/tests/compiler/dart2js/benign_error_test.dart b/tests/compiler/dart2js/benign_error_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..28c84dd658cd2fb5e69fd3ebf6f0f1d2a9eaecb2
--- /dev/null
+++ b/tests/compiler/dart2js/benign_error_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2015, 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 benign error do not prevent compilation.
+
+import 'memory_compiler.dart';
+
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/diagnostics/messages.dart';
+import 'package:compiler/src/js_backend/js_backend.dart';
+import 'package:expect/expect.dart';
+
+main() {
+ asyncTest(() async {
+ for (MessageKind kind in Compiler.BENIGN_ERRORS) {
+ await testExamples(kind);
+ }
+ });
+}
+
+testExamples(MessageKind kind) async {
+ MessageTemplate template = MessageTemplate.TEMPLATES[kind];
+ for (var example in template.examples) {
+ if (example is! Map) {
+ example = {'main.dart': example};
+ }
+ DiagnosticCollector collector = new DiagnosticCollector();
+ CompilationResult result = await runCompiler(
+ memorySourceFiles: example,
+ diagnosticHandler: collector);
+ Expect.isTrue(result.isSuccess);
+ Expect.isTrue(
+ collector.errors.any((message) => message.messageKind == kind));
+ Compiler compiler = result.compiler;
+ JavaScriptBackend backend = compiler.backend;
+ Expect.isNotNull(backend.generatedCode[compiler.mainFunction]);
+ }
+}
« 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