1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 03:08:11 +00:00

Libraries: Move to Userland/Libraries/

This commit is contained in:
Andreas Kling 2021-01-12 12:17:30 +01:00
parent dc28c07fa5
commit 13d7c09125
1857 changed files with 266 additions and 274 deletions

View file

@ -1,53 +0,0 @@
// prettier-ignore
test("new-expression parsing", () => {
function Foo() {
this.x = 1;
}
let foo = new Foo();
expect(foo.x).toBe(1);
foo = new Foo
expect(foo.x).toBe(1);
foo = new
Foo
();
expect(foo.x).toBe(1);
foo = new Foo + 2
expect(foo).toBe("[object Object]2");
});
// prettier-ignore
test("new-expressions with object keys", () => {
let a = {
b: function () {
this.x = 2;
},
};
foo = new a.b();
expect(foo.x).toBe(2);
foo = new a.b;
expect(foo.x).toBe(2);
foo = new
a.b();
expect(foo.x).toBe(2);
});
test("new-expressions with function calls", () => {
function funcGetter() {
return function (a, b) {
this.x = a + b;
};
}
foo = new funcGetter()(1, 5);
expect(foo).toBeUndefined();
foo = new (funcGetter())(1, 5);
expect(foo.x).toBe(6);
});