Created
June 8, 2015 14:32
-
-
Save clupasq/6144b04373dd01d514e6 to your computer and use it in GitHub Desktop.
JavaScript Simple Asserts
This file contains hidden or 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 assertEquals(expected, actual){ | |
if(expected === actual){ | |
console.info('OK'); | |
} else { | |
console.error('(' + expected + ') !== (' + actual + ') !!!'); | |
} | |
} | |
function assertThrows(f){ | |
try{ | |
f(); | |
console.error('Expected ' + f + "to throw, but it didn't!"); | |
} catch(e) { | |
console.info('OK.'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment