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
commit 3f97d75778
Notes: sideshowbarker 2024-07-19 05:04:44 +09:00
107 changed files with 2031 additions and 2243 deletions

View file

@ -1,18 +1,12 @@
load("test-common.js")
test("basic functionality", () => {
expect(Math.trunc).toHaveLength(1);
try {
assert(Math.trunc(13.37) === 13);
assert(Math.trunc(42.84) === 42);
assert(Math.trunc(0.123) === 0);
assert(Math.trunc(-0.123) === -0);
expect(Math.trunc(13.37)).toBe(13);
expect(Math.trunc(42.84)).toBe(42);
expect(Math.trunc(0.123)).toBe( 0);
expect(Math.trunc(-0.123)).toBe(-0);
assert(isNaN(Math.trunc(NaN)));
assert(isNaN(Math.trunc('foo')));
assert(isNaN(Math.trunc()));
assert(Math.trunc.length === 1);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}
expect(Math.trunc(NaN)).toBeNaN();
expect(Math.trunc('foo')).toBeNaN();
expect(Math.trunc()).toBeNaN();
});