blob: d94531f361c19de5347ad1e83c69e7d6a8dabf6b [file] [log] [blame]
* Copyright (c) 2011, 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.
* @assertion Otherwise, control is transferred to the nearest innermost
* enclosing exception handler.
* @description Checks that the statement of the form "rethrow;" indeed
* transfers control to the nearest enclosing exception handler if there is one,
* leaving the current exception unchanged.
* @note Can not test if the stack trace is unchanged because stack trace
* equality is unspecified in spec (co19 issue 719)
* @author rodionov
* @reviewer iefremov
import '../../../Utils/expect.dart';
main() {
bool flag = false;
var strace;
var ex = "";
try {
try {
void foo() {
try {
throw ex;"This code shouldn't be executed");
} on int catch (i) {
} catch (v, st) {
strace = st;
rethrow;"This code shouldn't be executed");
}"This code shouldn't be executed");
foo();"This code shouldn't be executed");
} on int catch (i) {}"This code shouldn't be executed");
} on int catch (i) {
} catch (s, st) {
flag = true;
Expect.isTrue(identical(ex, s));
Expect.isTrue(identical(strace, st)); // see note
Expect.isTrue(flag, "The correct exception handler wasn't triggered");