Serenity Operating System
1test("basic functionality", () => {
2 function foo() {}
3 expect(foo).toHaveLength(0);
4 expect((foo.length = 5)).toBe(5);
5 expect(foo).toHaveLength(0);
6
7 function bar(a, b, c) {}
8 expect(bar).toHaveLength(3);
9 expect((bar.length = 5)).toBe(5);
10 expect(bar).toHaveLength(3);
11});
12
13test("functions with special parameter lists", () => {
14 function baz(a, b = 1, c) {}
15 expect(baz).toHaveLength(1);
16 expect((baz.length = 5)).toBe(5);
17 expect(baz).toHaveLength(1);
18
19 function qux(a, b, ...c) {}
20 expect(qux).toHaveLength(2);
21 expect((qux.length = 2)).toBe(2);
22 expect(qux).toHaveLength(2);
23});