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

Unified Diff: pkg/front_end/test/kernel_generator_test.dart

Issue 2979623002: Use messages for (some) public API errors (Closed)
Patch Set: cl comments Created 3 years, 5 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: pkg/front_end/test/kernel_generator_test.dart
diff --git a/pkg/front_end/test/kernel_generator_test.dart b/pkg/front_end/test/kernel_generator_test.dart
index 831dbaf63c5988368269709197a62acb67955afe..1e773fbdbbe4113c51181b896d2206b332325664 100644
--- a/pkg/front_end/test/kernel_generator_test.dart
+++ b/pkg/front_end/test/kernel_generator_test.dart
@@ -56,16 +56,18 @@ main() {
var errors = [];
var options = new CompilerOptions()..onError = (e) => errors.add(e);
await compileScript('a() => print("hi");', options: options);
- expect('${errors.first}', contains("No 'main' method found"));
+ // TODO(sigmund): when we expose codes in the public APIs, we should
+ // compare the code here and not the message.
+ expect(errors.first.message, contains("No 'main' method found"));
ahe 2017/07/13 00:03:38 I think this might work: equals(messageMissingMai
Siggi Cherem (dart-lang) 2017/07/18 00:32:57 Done.
});
test('default error handler throws', () async {
var exceptionThrown = false;
try {
await compileScript('a() => print("hi");');
- } catch (e) {
+ } on CompilationError catch (e) {
exceptionThrown = true;
- expect('$e', contains("No 'main' method found"));
+ expect(e.message, contains("No 'main' method found"));
}
expect(exceptionThrown, isTrue);
});
@@ -146,7 +148,7 @@ main() {
'b.dart': ''
};
await compileUnit(['a.dart'], sources, options: options);
- expect(errors.first.toString(), contains('Invalid access'));
+ expect(errors.first.message, contains('Invalid access'));
errors.clear();
await compileUnit(['a.dart', 'b.dart'], sources, options: options);

Powered by Google App Engine
This is Rietveld 408576698