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

Unified Diff: tests/language/on_catch_malformed_type_test.dart

Issue 54983007: Make test of malformed types a dynamic type error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 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
« no previous file with comments | « tests/language/malformed2_test.dart ('k') | tests/language/type_parameter_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/on_catch_malformed_type_test.dart
diff --git a/tests/language/on_catch_malformed_type_test.dart b/tests/language/on_catch_malformed_type_test.dart
index a7e18ef190f2f3d99ea5a33493814cc63a34381e..e4c1f86910a982198f5b292e86d27a218c210676 100644
--- a/tests/language/on_catch_malformed_type_test.dart
+++ b/tests/language/on_catch_malformed_type_test.dart
@@ -3,8 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
// Check that malformed types in on-catch are handled correctly, that is,
-// are treated as dynamic and thus catches all in bith production and checked
-// mode.
+// throws a type error in both production and checked mode.
+
+import 'package:expect/expect.dart';
catchUnresolvedBefore() {
try {
@@ -18,15 +19,17 @@ catchUnresolvedBefore() {
}
catchUnresolvedAfter() {
- try {
- throw "foo";
- Expect.fail("This code shouldn't be executed");
- } on Unavailable catch(ex) {
- // This is tested before the catch block below.
- // In both production and checked mode the test is always true.
- } on String catch(oks) {
- Expect.fail("This code shouldn't be executed");
- }
+ Expect.throws(() {
+ try {
+ throw "foo";
+ Expect.fail("This code shouldn't be executed");
+ } on Unavailable catch(ex) {
+ // This is tested before the catch block below.
+ // In both production and checked mode the test causes a type error.
+ } on String catch(oks) {
+ Expect.fail("This code shouldn't be executed");
+ }
+ }, (e) => e is TypeError);
}
main() {
« no previous file with comments | « tests/language/malformed2_test.dart ('k') | tests/language/type_parameter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698