diff options
Diffstat (limited to 'deps/v8/test/webkit/resources/standalone-pre.js')
-rw-r--r-- | deps/v8/test/webkit/resources/standalone-pre.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/deps/v8/test/webkit/resources/standalone-pre.js b/deps/v8/test/webkit/resources/standalone-pre.js index 5f164dbcb5..3c94dd64c1 100644 --- a/deps/v8/test/webkit/resources/standalone-pre.js +++ b/deps/v8/test/webkit/resources/standalone-pre.js @@ -89,9 +89,12 @@ function isResultCorrect(_actual, _expected) function stringify(v) { + if (v) + return v.toString(); if (v === 0 && 1/v < 0) return "-0"; - else return "" + v; + else + return "" + v; } function shouldBe(_a, _b) @@ -114,7 +117,7 @@ function shouldBe(_a, _b) else if (typeof(_av) == typeof(_bv)) testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + "."); else - testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ")."); + testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + stringify(_av) + " (of type " + typeof _av + ")."); } function shouldBeTrue(_a) { shouldBe(_a, "true"); } @@ -171,7 +174,18 @@ function shouldThrow(_a, _e) } else if (typeof _av == "undefined") testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined."); else - testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + "."); + testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + stringify(_av) + "."); +} + + +function shouldNotThrow(_a) +{ + try { + eval(_a); + testPassed(_a + " did not throw exception."); + } catch (e) { + testFailed(_a + " should not throw exception. Threw exception " + e + "."); + } } function isSuccessfullyParsed() |