Mercurial > js4py-pl
comparison core-javascript/javascript-exercises/testtools.js @ 168:2d78ae4f0dfa javascript-exercises
Make a start on interactive exercise environment and additional exercises.
| author | jf3243 |
|---|---|
| date | Thu, 10 Nov 2011 12:28:41 +0000 |
| parents | 44d0ccb983d3 |
| children | 19e88fb18c4e |
comparison
equal
deleted
inserted
replaced
| 167:8f05cc516185 | 168:2d78ae4f0dfa |
|---|---|
| 8 log = function(s){ | 8 log = function(s){ |
| 9 print(s + '\n'); | 9 print(s + '\n'); |
| 10 }; | 10 }; |
| 11 } else { | 11 } else { |
| 12 log = print; | 12 log = print; |
| 13 log = writeln; // Wrong, but get us working in jsdb.exe. | |
| 13 } | 14 } |
| 14 | 15 |
| 15 // | 16 // |
| 16 var TEST = function(title, code){ | 17 var TEST = function(title, code){ |
| 17 | 18 |
| 35 var msg = '! assert ' + _assertion_count + ' has failed'; | 36 var msg = '! assert ' + _assertion_count + ' has failed'; |
| 36 log(msg); | 37 log(msg); |
| 37 } | 38 } |
| 38 }; | 39 }; |
| 39 | 40 |
| 41 var submit = function(name){ | |
| 42 | |
| 43 var filename = name + '-exercises.js'; | |
| 44 var status = run(filename); | |
| 45 | |
| 46 if (!status){ | |
| 47 writeln("Could not find file '" + filename + "'"); | |
| 48 } | |
| 49 | |
| 50 }; |
