summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/new-expression.js
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Tests/new-expression.js')
-rw-r--r--Libraries/LibJS/Tests/new-expression.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/Libraries/LibJS/Tests/new-expression.js b/Libraries/LibJS/Tests/new-expression.js
deleted file mode 100644
index 827b156910..0000000000
--- a/Libraries/LibJS/Tests/new-expression.js
+++ /dev/null
@@ -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);
-});