1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-17 13:15:06 +00:00
serenity/Libraries/LibJS/Tests/Date.now.js
Linus Groh d4e3688f4f LibJS: Start implementing Date :^)
This adds:

- A global Date object (with `length` property and `now` function)
- The Date constructor (no arguments yet)
- The Date prototype (with `get*` functions)
2020-03-30 14:11:54 +02:00

15 lines
323 B
JavaScript

function assert(x) { if (!x) throw 1; }
try {
var last = 0;
for (var i = 0; i < 100; ++i) {
var now = Date.now();
assert(!isNaN(now))
assert(now > 1580000000000);
assert(now >= last);
last = now;
}
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}