Skip to content

Instantly share code, notes, and snippets.

@clupasq
Created June 8, 2015 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clupasq/6144b04373dd01d514e6 to your computer and use it in GitHub Desktop.
Save clupasq/6144b04373dd01d514e6 to your computer and use it in GitHub Desktop.
JavaScript Simple Asserts
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