summaryrefslogtreecommitdiff
path: root/modules/test-assert.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-05-24 23:40:16 -0500
committersanine <sanine.not@pm.me>2022-05-24 23:40:16 -0500
commit2f2ab5149701243647a5f8d60dc9f771e45b2a5a (patch)
tree5d11d0ede864155ebcca90cc9d5fede6c4acfedc /modules/test-assert.js
parent550b5a5a626c05e93dd5aafbed9f7b6bb62807e9 (diff)
add hacky frameworkless unit testing
Diffstat (limited to 'modules/test-assert.js')
-rw-r--r--modules/test-assert.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/test-assert.js b/modules/test-assert.js
new file mode 100644
index 0000000..7be2989
--- /dev/null
+++ b/modules/test-assert.js
@@ -0,0 +1,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 };