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

LibJS: Add a very basic test runner (shell script) + some tests

This commit is contained in:
Andreas Kling 2020-03-25 14:26:31 +01:00
parent a94a150df0
commit 45488401b1
5 changed files with 93 additions and 0 deletions

View file

@ -0,0 +1,23 @@
function assert(x) { if (!x) throw 1; }
try {
var a = [1, 2, 3];
assert(typeof a === "object");
assert(a.length === 3);
assert(a[0] === 1);
assert(a[1] === 2);
assert(a[2] === 3);
a[1] = 5;
assert(a[1] === 5);
assert(a.length === 3);
a.push(7);
assert(a[3] === 7);
assert(a.length === 4);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}