Last active
July 15, 2020 23:05
-
-
Save andremalan/df39d4ef0714298d39acc0e9f442323f to your computer and use it in GitHub Desktop.
A test harness for code pad like environments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tests = [ | |
[Math.max(1, 3), 3, 'can pass'], | |
[Math.max(1, 4), 3, 'can fail'], | |
]; | |
tests.forEach((test) => | |
console.log( | |
test[0].toString() === test[1].toString() ? 'pass!' : 'fail!', | |
'expected:', | |
test[1], | |
'result:', | |
test[0], | |
'message:', | |
test[2], | |
), | |
); | |
console.log(tests.every((t) => t[0].toString() === t[1].toString()) ? 'SUITE PASSES' : 'SUITE FAILS'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment