1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +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,19 +1,15 @@
load("test-common.js");
test("basic functionality", () => {
expect(Math.sin).toHaveLength(1);
try {
assert(Math.sin(0) === 0);
assert(Math.sin(null) === 0);
assert(Math.sin('') === 0);
assert(Math.sin([]) === 0);
assert(Math.sin(Math.PI * 3 / 2) === -1);
assert(Math.sin(Math.PI / 2) === 1);
assert(isNaN(Math.sin()));
assert(isNaN(Math.sin(undefined)));
assert(isNaN(Math.sin([1, 2, 3])));
assert(isNaN(Math.sin({})));
assert(isNaN(Math.sin("foo")));
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}
expect(Math.sin(0)).toBe(0);
expect(Math.sin(null)).toBe(0);
expect(Math.sin('')).toBe(0);
expect(Math.sin([])).toBe(0);
expect(Math.sin(Math.PI * 3 / 2)).toBe(-1);
expect(Math.sin(Math.PI / 2)).toBe(1);
expect(Math.sin()).toBeNaN();
expect(Math.sin(undefined)).toBeNaN();
expect(Math.sin([1, 2, 3])).toBeNaN();
expect(Math.sin({})).toBeNaN();
expect(Math.sin("foo")).toBeNaN();
});