diff options
Diffstat (limited to 'Libraries/LibJS/Tests/functions/function-rest-params.js')
-rw-r--r-- | Libraries/LibJS/Tests/functions/function-rest-params.js | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/Libraries/LibJS/Tests/functions/function-rest-params.js b/Libraries/LibJS/Tests/functions/function-rest-params.js deleted file mode 100644 index 83ed411675..0000000000 --- a/Libraries/LibJS/Tests/functions/function-rest-params.js +++ /dev/null @@ -1,47 +0,0 @@ -test("rest parameter with no arguments", () => { - function foo(...a) { - expect(a).toBeInstanceOf(Array); - expect(a).toHaveLength(0); - } - foo(); -}); - -test("rest parameter with arguments", () => { - function foo(...a) { - expect(a).toEqual(["foo", 123, undefined, { foo: "bar" }]); - } - foo("foo", 123, undefined, { foo: "bar" }); -}); - -test("rest parameter after normal parameters with no arguments", () => { - function foo(a, b, ...c) { - expect(a).toBe("foo"); - expect(b).toBe(123); - expect(c).toEqual([]); - } - foo("foo", 123); -}); - -test("rest parameter after normal parameters with arguments", () => { - function foo(a, b, ...c) { - expect(a).toBe("foo"); - expect(b).toBe(123); - expect(c).toEqual([undefined, { foo: "bar" }]); - } - foo("foo", 123, undefined, { foo: "bar" }); -}); - -test("basic arrow function rest parameters", () => { - let foo = (...a) => { - expect(a).toBeInstanceOf(Array); - expect(a).toHaveLength(0); - }; - foo(); - - foo = (a, b, ...c) => { - expect(a).toBe("foo"); - expect(b).toBe(123); - expect(c).toEqual([undefined, { foo: "bar" }]); - }; - foo("foo", 123, undefined, { foo: "bar" }); -}); |