Created
May 14, 2018 13:01
-
-
Save jhines2k7/f5da734dbcd06e08e90e891016c3871c to your computer and use it in GitHub Desktop.
World's simplest JavaScript test runner
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
function assertEqual(a, b, desc) { | |
if (a === b) { | |
console.log(`${desc} ... PASS`); | |
} else { | |
console.log(`${desc} ... FAIL: ${a} != ${b}`) | |
} | |
} | |
function assertThrowsError(func, desc) { | |
try { | |
func(); | |
console.log(`${desc} ... FAIL`); | |
} catch (e) { | |
console.log(`${desc} ... PASS`); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment