// The smallest thing that will do. Checks print a line per assertion so a // failure says what was expected of the code, not just which line threw. let fails = 0; let current = ""; export function suite(name) { current = name; console.log(`\n== ${name} ==`); } export function eq(got, want, what) { const g = JSON.stringify(got), w = JSON.stringify(want); if (g === w) { console.log(` ok ${what}`); return; } console.log(` FAIL ${what}\n got ${g}\n want ${w}`); fails++; } export function ok(cond, what) { eq(Boolean(cond), true, what); } export function failed() { return fails; } export function report(file) { if (fails === 0) console.log(`\n${file}: all passed`); else console.log(`\n${file}: ${fails} FAILED`); return fails; }