diff options
author | Brian Terlson <btthalion@gmail.com> | 2015-07-30 15:31:16 -0700 |
---|---|---|
committer | Brian Terlson <btthalion@gmail.com> | 2015-07-30 15:31:16 -0700 |
commit | eea8807d409e86a5f41106c34a50bef3861cb693 (patch) | |
tree | 1b2146ddbe44ae797384217751c91dc42fd30b79 /harness | |
parent | d40961b33440e2f37c3c8063ca9e858ef3313961 (diff) | |
parent | d1f718f8061a40309121376cc5b645909f5a78ee (diff) | |
download | qtdeclarative-testsuites-eea8807d409e86a5f41106c34a50bef3861cb693.tar.gz |
Merge pull request #355 from anba/regexp-unicode
B.1.4 and Unicode RegExps
Diffstat (limited to 'harness')
-rw-r--r-- | harness/assert.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/harness/assert.js b/harness/assert.js index 35abaf8f6..9abf3e13c 100644 --- a/harness/assert.js +++ b/harness/assert.js @@ -51,24 +51,30 @@ assert.notSameValue = function (actual, unexpected, message) { $ERROR(message); }; -assert.throws = function (expectedErrorConstructor, func) { +assert.throws = function (expectedErrorConstructor, func, message) { if (func === undefined) { $ERROR('assert.throws requires two arguments: the error constructor and a function to run'); return; } + if (message === undefined) { + message = ''; + } else { + message += ' '; + } try { func(); } catch (thrown) { if (typeof thrown !== 'object' || thrown === null) { - $ERROR('Thrown value was not an object!'); - return; - } - if (thrown.constructor !== expectedErrorConstructor) { - $ERROR('Expected a ' + expectedErrorConstructor.name + ' but got a ' + thrown.constructor.name); + message += 'Thrown value was not an object!'; + $ERROR(message); + } else if (thrown.constructor !== expectedErrorConstructor) { + message += 'Expected a ' + expectedErrorConstructor.name + ' but got a ' + thrown.constructor.name; + $ERROR(message); } return; } - $ERROR('Expected a ' + expectedErrorConstructor.name + ' to be thrown but no exception was thrown at all'); + message += 'Expected a ' + expectedErrorConstructor.name + ' to be thrown but no exception was thrown at all'; + $ERROR(message); }; |