|
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <title>D.O.H. v2</title> |
| 5 | + <meta http-equiv="content-type" content="text/html; charset=utf-8"> |
| 6 | +</head> |
| 7 | +<body> |
| 8 | + |
| 9 | + <h1>Self tests</h1> |
| 10 | + <p>This will run several tests using this library, don't be scared when some |
| 11 | + of the test fail, this is intentionally, to test the test suite itself.</p> |
| 12 | + |
| 13 | + <h2>Your result should look like this:</h2> |
| 14 | + <pre style="font-size: large; color: red;"> |
| 15 | +<span id="numTestsRan">0</span> tests ran, <span id="numFailures">0</span> failures, <span id="numErrors">0</span> errors |
| 16 | + </pre> |
| 17 | + |
| 18 | + <script type="text/javascript" src="doh.js"></script> |
| 19 | + <script type="text/javascript" src="util.js"></script> |
| 20 | + <script type="text/javascript" src="deferred.js"></script> |
| 21 | + <script type="text/javascript" src="assert.js"></script> |
| 22 | + <script type="text/javascript" src="ui.js"></script> |
| 23 | + <script type="text/javascript" src="selftests.js"></script> |
| 24 | + <script type="text/javascript"> |
| 25 | + // Go through all the tests and find out how many should fail |
| 26 | + // and how many should pass, the name of each test tells. |
| 27 | + // And fill the HTML above appropriately. |
| 28 | + var numTests = 0, |
| 29 | + numFailures = 0, |
| 30 | + numErrors = 0; |
| 31 | + for (var i=0, g; g=doh._groups[i]; i++){ |
| 32 | + numTests += g.tests.length; |
| 33 | + for (var j=0, t; t=g.tests[j]; j++){ |
| 34 | + if (t.name.indexOf("fail: ")===0){ |
| 35 | + numFailures++; |
| 36 | + } else if (t.name.indexOf("error: ")===0){ |
| 37 | + numErrors++; |
| 38 | + } |
| 39 | + } |
| 40 | + } |
| 41 | + document.getElementById("numTestsRan").innerHTML = numTests; |
| 42 | + document.getElementById("numFailures").innerHTML = numFailures; |
| 43 | + document.getElementById("numErrors").innerHTML = numErrors; |
| 44 | + |
| 45 | + doh.run(); |
| 46 | + </script> |
| 47 | +</body> |
| 48 | +</html> |
0 commit comments