Mercurial > js4py
view core-javascript/core-javascript-work/testtools.js @ 156:b774913eb242 core-javascript.closure-exercises
Remove trailing whitespace from js files (js2mode does not repsect delete-trailing-whitespace).
| author | jf3243 |
|---|---|
| date | Wed, 09 Nov 2011 15:37:03 +0000 |
| parents | 82f672a37506 |
| children |
line wrap: on
line source
var telltail = 'global'; var _assertion_count = 0; // Define a global function 'log'. var log; if (this.hasOwnProperty('jsArguments')){ log = function(s){ print(s + '\n'); }; } else { log = print; } // var TEST = function(title, code){ var x; log( 'Testing: ' + title ); _assertion_count = 0; try { code(); } catch (x) { log('! Exception at ' + x.fileName +':' + x.lineNumber); log('! [' + x.name + '] ' + x.message ); } }; var assert = function(arg){ _assertion_count += 1; if (!arg){ var msg = '! assert ' + _assertion_count + ' has failed'; log(msg); } };
