ladybird/Libraries/LibJS/Tests/throw-basic.js
2020-04-13 16:28:50 +02:00

28 lines
376 B
JavaScript

try {
throw 1;
assertNotReached();
} catch (e) {
assert(e === 1);
}
try {
throw [99];
assertNotReached();
} catch (e) {
assert(typeof e === "object");
assert(e.length === 1);
}
function foo() {
throw "hello";
assertNotReached();
}
try {
foo();
assertNotReached();
} catch (e) {
assert(e === "hello");
}
console.log("PASS");