Mercurial > js4py-pl
diff core-javascript/core-javascript-work/testtools.js @ 148:7f86f1a807f8 core-javascript
Get testtools.js running on JSDB (and some minor changes).
| author | jf3243 |
|---|---|
| date | Mon, 31 Oct 2011 15:50:46 +0000 |
| parents | 71b7fd796ddf |
| children |
line wrap: on
line diff
--- a/core-javascript/core-javascript-work/testtools.js Mon Oct 31 15:23:17 2011 +0000 +++ b/core-javascript/core-javascript-work/testtools.js Mon Oct 31 15:50:46 2011 +0000 @@ -3,7 +3,7 @@ // Define a global function 'log'. var log; -if (this.hasOwnProperty('jsArguments')){ +if (this.writeln){ // True if JSDB. log = function(s){ print(s + '\n'); @@ -12,7 +12,7 @@ log = print; } -// +// Log name of test and run the code. var TEST = function(title, code){ log( 'Testing: ' + title ); @@ -20,6 +20,7 @@ code(); }; +// Increment assertion code and report failure. var assert = function(arg){ _assertion_count += 1; if (!arg){
