mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
test-js: Use prettier and format all files
This commit is contained in:
parent
e532888242
commit
6d58c48c2f
248 changed files with 8291 additions and 7725 deletions
|
@ -1,49 +1,48 @@
|
|||
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");
|
||||
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");
|
||||
});
|
||||
|
||||
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);
|
||||
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;
|
||||
};
|
||||
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);
|
||||
}
|
||||
|
||||
foo = new funcGetter()(1, 5);
|
||||
expect(foo).toBeUndefined();
|
||||
|
||||
foo = new (funcGetter())(1, 5);
|
||||
expect(foo.x).toBe(6);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue