summaryrefslogtreecommitdiff
path: root/modules/test-assert.js
blob: 7be2989fee738e6e20f4a151023172ce7b9d0191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { strict as assert } from 'node:assert';

function test(description, func)
{
	process.stdout.write(description);
	let error = null;
	try {
		func();
	}
	catch(err) {
		error = err;
	}

	if (error) {
		console.log(' - FAIL'); 
		console.log(error);
	}
	else console.log(' - OK');
}

export { test, assert };