ladybird/Libraries/LibJS/Tests/instanceof-basic.js
Brian Gianforcaro bc40908d32 LibJS: Use the native assert() implementation now avaiable in 'js -t'
Switch the LibJS test suite to use the native assert implementation
surfaced inside the js repl when it's launched in test mode.
2020-04-05 15:28:45 +02:00

26 lines
463 B
JavaScript

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);
}