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

Unified Diff: tests/compiler/dart2js/message_kind_helper.dart

Issue 21544003: Handle missing imports/exports/parts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add example to warning. Created 7 years, 4 months 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
Index: tests/compiler/dart2js/message_kind_helper.dart
diff --git a/tests/compiler/dart2js/message_kind_helper.dart b/tests/compiler/dart2js/message_kind_helper.dart
index f972a96fc57cf96bb752a8e8e42f6e49c1c3c1ee..6302bf190608302f6e25b8b008093c02377840c4 100644
--- a/tests/compiler/dart2js/message_kind_helper.dart
+++ b/tests/compiler/dart2js/message_kind_helper.dart
@@ -14,8 +14,13 @@ import 'memory_compiler.dart';
const String ESCAPE_REGEXP = r'[[\]{}()*+?.\\^$|]';
-Compiler check(MessageKind kind, Compiler cachedCompiler) {
- Expect.isNotNull(kind.howToFix);
+Compiler check(MessageKind kind, Compiler cachedCompiler,
+ {bool expectNoHowToFix: false}) {
+ if (expectNoHowToFix) {
+ Expect.isNull(kind.howToFix);
+ } else {
+ Expect.isNotNull(kind.howToFix);
+ }
Expect.isFalse(kind.examples.isEmpty);
for (String example in kind.examples) {
@@ -37,7 +42,9 @@ Compiler check(MessageKind kind, Compiler cachedCompiler) {
Expect.isFalse(messages.isEmpty, 'No messages in """$example"""');
- String pattern = '${kind.template}\n${kind.howToFix}'.replaceAllMapped(
+ String expectedText = kind.howToFix == null
+ ? kind.template : '${kind.template}\n${kind.howToFix}';
+ String pattern = expectedText.replaceAllMapped(
new RegExp(ESCAPE_REGEXP), (m) => '\\${m[0]}');
pattern = pattern.replaceAll(new RegExp(r'#\\\{[^}]*\\\}'), '.*');

Powered by Google App Engine
This is Rietveld 408576698