arthur/selftest.html

22 lines
1.1 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><title>selftest</title>
<style>
body{background:#0b0d13;color:#e8eaf0;font:13px/1.6 ui-monospace,Menlo,monospace;padding:20px}
li{list-style:none} .p{color:#4ade80} .f{color:#f87171}
b{font-weight:400;color:#8891a5} h1{font-size:14px}
</style></head><body>
<h1 id="head">running…</h1><ul id="out"></ul>
<script type="module">
import { run, runWiring } from './js/selftest.js';
let res;
try { res = run(); }
catch (e) { res = [{ name: 'harness threw: ' + e.message, pass: false, detail: String(e.stack).split('\n')[1] || '' }]; }
res = res.concat(await runWiring());
const pass = res.filter(r => r.pass).length;
const fail = res.length - pass;
document.getElementById('head').textContent = `${fail === 0 ? 'PASS' : 'FAIL'} — ${pass}/${res.length} assertions`;
document.title = `${fail === 0 ? 'PASS' : 'FAIL'} ${pass}/${res.length}`;
document.getElementById('out').innerHTML = res.map(r =>
`<li class="${r.pass ? 'p' : 'f'}">${r.pass ? '✓' : '✗'} ${r.name}${r.detail ? ` <b>${r.detail}</b>` : ''}</li>`).join('');
</script></body></html>