dart-sdk/tests/language_2/switch_try_catch_test.dart
pq 9d37eaaa10 Migrate test block 156 to Dart 2.0.
Bug:
Change-Id: I2cbff93b804f70e77b9db95655e1d0f16149837b
Reviewed-on: https://dart-review.googlesource.com/12120
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2017-10-09 13:53:54 +00:00

37 lines
752 B
Dart

// Copyright (c) 2014, 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.
// Regression test for issue 18869: Check that try-catch is working correctly
// inside switch-case clauses.
import "package:expect/expect.dart";
test_switch() {
switch (0) {
_0:
case 0:
print("_0");
continue _5;
_1:
case 1:
try {
print("bunny");
continue _6;
} catch (e) {}
break;
_5:
case 5:
print("_5");
continue _6;
_6:
case 6:
print("_6");
throw 555;
}
}
main() {
Expect.throws(() => test_switch(), (e) => e == 555);
}