diff options
Diffstat (limited to 'src/modules/test-assert.js')
-rw-r--r-- | src/modules/test-assert.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/modules/test-assert.js b/src/modules/test-assert.js new file mode 100644 index 0000000..7be2989 --- /dev/null +++ b/src/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 }; |