mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 07:45:07 +00:00
Libraries: Move to Userland/Libraries/
This commit is contained in:
parent
dc28c07fa5
commit
13d7c09125
1857 changed files with 266 additions and 274 deletions
|
@ -1,68 +0,0 @@
|
|||
test("basic functionality", () => {
|
||||
const A = class {
|
||||
constructor(x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
getX() {
|
||||
return this.x * 2;
|
||||
}
|
||||
};
|
||||
|
||||
expect(new A(10).getX()).toBe(20);
|
||||
});
|
||||
|
||||
test("inline instantiation", () => {
|
||||
// prettier-ignore
|
||||
const a = new class {
|
||||
constructor() {
|
||||
this.x = 10;
|
||||
}
|
||||
|
||||
getX() {
|
||||
return this.x * 2;
|
||||
}
|
||||
};
|
||||
|
||||
expect(a.getX()).toBe(20);
|
||||
});
|
||||
|
||||
test("inline instantiation with argument", () => {
|
||||
// prettier-ignore
|
||||
const a = new class {
|
||||
constructor(x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
getX() {
|
||||
return this.x * 2;
|
||||
}
|
||||
}(10);
|
||||
|
||||
expect(a.getX()).toBe(20);
|
||||
});
|
||||
|
||||
test("extending class expressions", () => {
|
||||
class A extends class {
|
||||
constructor(x) {
|
||||
this.x = x;
|
||||
}
|
||||
} {
|
||||
constructor(y) {
|
||||
super(y);
|
||||
this.y = y * 2;
|
||||
}
|
||||
}
|
||||
|
||||
const a = new A(10);
|
||||
expect(a.x).toBe(10);
|
||||
expect(a.y).toBe(20);
|
||||
});
|
||||
|
||||
test("class expression name", () => {
|
||||
let A = class {};
|
||||
expect(A.name).toBe("A");
|
||||
|
||||
let B = class C {};
|
||||
expect(B.name).toBe("C");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue