ladybird/Libraries/LibJS/Tests/throw-basic.js

29 lines
376 B
JavaScript
Raw Normal View History

try {
throw 1;
2020-04-13 14:11:09 +01:00
assertNotReached();
} catch (e) {
assert(e === 1);
}
try {
throw [99];
2020-04-13 14:11:09 +01:00
assertNotReached();
} catch (e) {
assert(typeof e === "object");
assert(e.length === 1);
}
function foo() {
throw "hello";
2020-04-13 14:11:09 +01:00
assertNotReached();
}
try {
foo();
2020-04-13 14:11:09 +01:00
assertNotReached();
} catch (e) {
assert(e === "hello");
}
console.log("PASS");