mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
d74ad81402
The addition of assert functions to Userland/js was done before we had load(..) implemented. Now that it exists, it seems like the right move the test helper functions to pure javascript instead of poluting js with random global functions.
30 lines
401 B
JavaScript
30 lines
401 B
JavaScript
load("test-common.js");
|
|
|
|
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");
|