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

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

Issue 1415463022: Use DiagnosticMessage in MockCompiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/analyze_all_test.dart
diff --git a/tests/compiler/dart2js/analyze_all_test.dart b/tests/compiler/dart2js/analyze_all_test.dart
index caab884c163064c4f7686e6666b77da77f6d618b..2bb4808ee60e3ba4f0ae3c25474233fc8a0cdc43 100644
--- a/tests/compiler/dart2js/analyze_all_test.dart
+++ b/tests/compiler/dart2js/analyze_all_test.dart
@@ -31,26 +31,28 @@ main() {
Uri uri = Uri.parse('test:code');
var compiler1 = compilerFor(SOURCE, uri, analyzeAll: false);
asyncTest(() => compiler1.run(uri).then((compilationSucceded) {
+ DiagnosticCollector collector = compiler1.diagnosticCollector;
Expect.isTrue(compilationSucceded);
- print(compiler1.warnings);
- Expect.isTrue(compiler1.warnings.isEmpty, 'unexpected warnings');
- Expect.isTrue(compiler1.errors.isEmpty, 'unexpected errors');
+ print(collector.warnings);
+ Expect.isTrue(collector.warnings.isEmpty, 'unexpected warnings');
+ Expect.isTrue(collector.errors.isEmpty, 'unexpected errors');
}));
var compiler2 = compilerFor(SOURCE, uri, analyzeAll: true);
asyncTest(() => compiler2.run(uri).then((compilationSucceded) {
+ DiagnosticCollector collector = compiler2.diagnosticCollector;
Expect.isFalse(compilationSucceded);
- Expect.isTrue(compiler2.warnings.isEmpty,
- 'unexpected warnings: ${compiler2.warnings}');
- Expect.equals(2, compiler2.errors.length,
- 'expected exactly two errors, but got ${compiler2.errors}');
-
- Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
- compiler2.errors[0].message.kind);
- Expect.equals("Foo", compiler2.errors[0].node.toString());
-
- Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST,
- compiler2.errors[1].message.kind);
- Expect.equals("Foo", compiler2.errors[1].node.toString());
+ Expect.isTrue(collector.warnings.isEmpty,
+ 'unexpected warnings: ${collector.warnings}');
+ Expect.equals(2, collector.errors.length,
+ 'expected exactly two errors, but got ${collector.errors}');
+
+ CollectedMessage first = collector.errors.first;
+ Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, first.message.kind);
+ Expect.equals("Foo", SOURCE.substring(first.begin, first.end));
+
+ CollectedMessage second = collector.errors.elementAt(1);
+ Expect.equals(MessageKind.CONSTRUCTOR_IS_NOT_CONST, second.message.kind);
+ Expect.equals("Foo", SOURCE.substring(second.begin, second.end));
}));
}

Powered by Google App Engine
This is Rietveld 408576698