| OLD | NEW |
| 1 // js-test now supports lazily printing test results which dumps all test | 1 // js-test now supports lazily printing test results which dumps all test |
| 2 // results once at the end of the test instead of building them up. To enable | 2 // results once at the end of the test instead of building them up. To enable |
| 3 // this option, call setPrintTestResultsLazily() before running any tests. | 3 // this option, call setPrintTestResultsLazily() before running any tests. |
| 4 var _lazyTestResults; // Set by setPrintTestResultsLazily(). | 4 var _lazyTestResults; // Set by setPrintTestResultsLazily(). |
| 5 | 5 |
| 6 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results | 6 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results |
| 7 if (self.testRunner) { | 7 if (self.testRunner) { |
| 8 if (self.enablePixelTesting) | 8 if (self.enablePixelTesting) |
| 9 testRunner.dumpAsTextWithPixelResults(); | 9 testRunner.dumpAsTextWithPixelResults(); |
| 10 else | 10 else |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 if (opt_tolerance) | 509 if (opt_tolerance) |
| 510 shouldBeCloseTo(actual, expected, opt_tolerance); | 510 shouldBeCloseTo(actual, expected, opt_tolerance); |
| 511 else | 511 else |
| 512 shouldBe(actual, stringify(expected)); | 512 shouldBe(actual, stringify(expected)); |
| 513 } else { | 513 } else { |
| 514 debug(expected + " is unknown type " + typeof expected); | 514 debug(expected + " is unknown type " + typeof expected); |
| 515 shouldBeTrue(actual, "'" +expected.toString() + "'"); | 515 shouldBeTrue(actual, "'" +expected.toString() + "'"); |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 | 518 |
| 519 function shouldEvaluateToSameObject(actual, expected, quiet) { |
| 520 if (typeof actual != "string") |
| 521 debug("WARN: shouldEvaluateToSameObject() expects the first argument (actual
) to be a string."); |
| 522 try { |
| 523 actualEvaled = eval(actual); |
| 524 } catch (e) { |
| 525 testFailed("Evaluating " + actual + ": Threw exception " + e); |
| 526 return; |
| 527 } |
| 528 if (isResultCorrect(actualEvaled, expected)) { |
| 529 if (!quiet) |
| 530 testPassed(actual + " is " + stringify(expected)); |
| 531 } else { |
| 532 testFailed(actual + " should be " + stringify(expected) + ". Was " + stringi
fy(actualEvaled)); |
| 533 } |
| 534 } |
| 535 |
| 519 function shouldBeNonZero(_a) | 536 function shouldBeNonZero(_a) |
| 520 { | 537 { |
| 521 var _exception; | 538 var _exception; |
| 522 var _av; | 539 var _av; |
| 523 try { | 540 try { |
| 524 _av = eval(_a); | 541 _av = eval(_a); |
| 525 } catch (e) { | 542 } catch (e) { |
| 526 _exception = e; | 543 _exception = e; |
| 527 } | 544 } |
| 528 | 545 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 testPassed = function(msg) { | 909 testPassed = function(msg) { |
| 893 workerPort.postMessage('PASS:' + msg); | 910 workerPort.postMessage('PASS:' + msg); |
| 894 }; | 911 }; |
| 895 finishJSTest = function() { | 912 finishJSTest = function() { |
| 896 workerPort.postMessage('DONE:'); | 913 workerPort.postMessage('DONE:'); |
| 897 }; | 914 }; |
| 898 debug = function(msg) { | 915 debug = function(msg) { |
| 899 workerPort.postMessage(msg); | 916 workerPort.postMessage(msg); |
| 900 }; | 917 }; |
| 901 } | 918 } |
| OLD | NEW |