mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
100
Libraries/LibJS/Tests/classes/class-errors.js
Normal file
100
Libraries/LibJS/Tests/classes/class-errors.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
describe("non-syntax errors", () => {
|
||||
test("super reference inside nested-but-same |this| scope with no base class", () => {
|
||||
expect(`
|
||||
class A {
|
||||
foo() {
|
||||
() => { super.bar; }
|
||||
}
|
||||
}`).toEval();
|
||||
});
|
||||
|
||||
test("super reference property lookup with no base class", () => {
|
||||
expect(`
|
||||
class A {
|
||||
constructor() {
|
||||
super.foo;
|
||||
}
|
||||
}`).toEval();
|
||||
});
|
||||
});
|
||||
|
||||
describe("reference errors", () => {
|
||||
test("derived class doesn't call super in constructor before using this", () => {
|
||||
class Parent {}
|
||||
class Child extends Parent {
|
||||
constructor() {
|
||||
this;
|
||||
}
|
||||
}
|
||||
|
||||
expect(() => {
|
||||
new Child();
|
||||
}).toThrowWithMessage(ReferenceError, "|this| has not been initialized");
|
||||
});
|
||||
|
||||
test("derived class calls super twice in constructor", () => {
|
||||
class Parent {}
|
||||
class Child extends Parent {
|
||||
constructor() {
|
||||
super();
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
expect(() => {
|
||||
new Child();
|
||||
}).toThrowWithMessage(ReferenceError, "|this| is already initialized");
|
||||
});
|
||||
});
|
||||
|
||||
describe("syntax errors", () => {
|
||||
test("getter with argument", () => {
|
||||
expect(`
|
||||
class A {
|
||||
get foo(v) {
|
||||
return 0;
|
||||
}
|
||||
}`).not.toEval();
|
||||
});
|
||||
|
||||
test("setter with no arguments", () => {
|
||||
expect(`
|
||||
class A {
|
||||
set foo() {
|
||||
}
|
||||
}`).not.toEval();
|
||||
});
|
||||
|
||||
test("setter with more than one argument", () => {
|
||||
expect(`
|
||||
class A {
|
||||
set foo(bar, baz) {
|
||||
}
|
||||
}`).not.toEval();
|
||||
expect(`
|
||||
class A {
|
||||
set foo(...bar) {
|
||||
}
|
||||
}`).not.toEval();
|
||||
});
|
||||
|
||||
test("super reference inside different |this| scope", () => {
|
||||
expect(`
|
||||
class Parent {}
|
||||
|
||||
class Child extends Parent {
|
||||
foo() {
|
||||
function f() { super.foo; }
|
||||
}
|
||||
}`).not.toEval();
|
||||
});
|
||||
|
||||
test("super reference call with no base class", () => {
|
||||
expect(`
|
||||
class A {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}`).not.toEval();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue