1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibJS: Convert most builtin tests to new system

This commit is contained in:
Matthew Olsson 2020-07-04 10:09:48 -07:00 committed by Andreas Kling
parent 46581773c1
commit 3f97d75778
107 changed files with 2031 additions and 2243 deletions

View file

@ -1,16 +1,14 @@
load("test-common.js");
test("basic functionality", () => {
expect(Math.abs).toHaveLength(1);
try {
assert(Math.abs('-1') === 1);
assert(Math.abs(-2) === 2);
assert(Math.abs(null) === 0);
assert(Math.abs('') === 0);
assert(Math.abs([]) === 0);
assert(Math.abs([2]) === 2);
assert(isNaN(Math.abs([1, 2])));
assert(isNaN(Math.abs({})));
assert(isNaN(Math.abs('string')));
assert(isNaN(Math.abs()));
console.log("PASS");
} catch {
}
expect(Math.abs('-1')).toBe(1);
expect(Math.abs(-2)).toBe(2);
expect(Math.abs(null)).toBe(0);
expect(Math.abs('')).toBe(0);
expect(Math.abs([])).toBe(0);
expect(Math.abs([2])).toBe(2);
expect(Math.abs([1, 2])).toBeNaN();
expect(Math.abs({})).toBeNaN();
expect(Math.abs('string')).toBeNaN();
expect(Math.abs()).toBeNaN();
});