mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 22:08:59 +00:00
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.
28 lines
488 B
JavaScript
28 lines
488 B
JavaScript
load("test-common.js");
|
|
|
|
try {
|
|
function Foo() {
|
|
this.x = 123;
|
|
}
|
|
|
|
var foo = new Foo();
|
|
assert(foo instanceof Foo);
|
|
|
|
function Base() {
|
|
this.is_base = true;
|
|
}
|
|
|
|
function Derived() {
|
|
this.is_derived = true;
|
|
}
|
|
|
|
Object.setPrototypeOf(Derived.prototype, Base.prototype);
|
|
|
|
var d = new Derived();
|
|
assert(d instanceof Derived);
|
|
assert(d instanceof Base);
|
|
|
|
console.log("PASS");
|
|
} catch(e) {
|
|
console.log("FAIL: " + e);
|
|
}
|