blob: 34197530b5f8bc1f405f491c021f903450145837 [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
function throwException() {
throw new Error(`Cocoa`);
}
shouldBe(function () {
try {
throwException();
} catch {
return true;
}
return false;
}(), true);
shouldBe(function () {
var ok = false;
try {
throwException();
} catch {
ok = true;
return false;
} finally {
return ok;
}
return false;
}(), true);
shouldBe(function () {
let value = 'Cocoa';
try {
throwException();
} catch {
let value = 'Cappuccino';
return value;
}
}(), 'Cappuccino');
shouldBe(function () {
var value = 'Cocoa';
try {
throwException();
} catch {
let value = 'Cappuccino';
}
return value;
}(), 'Cocoa');