mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 12:07:35 +00:00
LibJS: Convert all remaining non-Array tests to the new system :)
This commit is contained in:
parent
918f4affd5
commit
15de2eda2b
72 changed files with 2394 additions and 1998 deletions
|
@ -1,27 +1,23 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
test("basic functionality", () => {
|
||||
function foo() {}
|
||||
assert(foo.length === 0);
|
||||
assert((foo.length = 5) === 5);
|
||||
assert(foo.length === 0);
|
||||
expect(foo).toHaveLength(0);
|
||||
expect((foo.length = 5)).toBe(5);
|
||||
expect(foo).toHaveLength(0);
|
||||
|
||||
function bar(a, b, c) {}
|
||||
assert(bar.length === 3);
|
||||
assert((bar.length = 5) === 5);
|
||||
assert(bar.length === 3);
|
||||
expect(bar).toHaveLength(3);
|
||||
expect((bar.length = 5)).toBe(5);
|
||||
expect(bar).toHaveLength(3);
|
||||
});
|
||||
|
||||
test("functions with special parameter lists", () => {
|
||||
function baz(a, b = 1, c) {}
|
||||
assert(baz.length === 1);
|
||||
assert((baz.length = 5) === 5);
|
||||
assert(baz.length === 1);
|
||||
expect(baz).toHaveLength(1);
|
||||
expect((baz.length = 5)).toBe(5);
|
||||
expect(baz).toHaveLength(1);
|
||||
|
||||
function qux(a, b, ...c) {}
|
||||
assert(qux.length === 2);
|
||||
assert((qux.length = 5) === 5);
|
||||
assert(qux.length === 2);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
||||
expect(qux).toHaveLength(2);
|
||||
expect((qux.length = 2)).toBe(2);
|
||||
expect(qux).toHaveLength(2);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue