diff options
author | Brian Terlson <brian.terlson@microsoft.com> | 2014-12-09 13:46:53 -0800 |
---|---|---|
committer | Brian Terlson <brian.terlson@microsoft.com> | 2014-12-09 13:46:53 -0800 |
commit | 1f2f7d062fdfa73b5e96b0483f90e6c40a9db53e (patch) | |
tree | 533e6d916ff0d378e70b987bdc6d1200a311d03a /test/harness | |
parent | 83b07ff15eadb141c3d6f4d236a8733b720041d2 (diff) | |
download | qtdeclarative-testsuites-1f2f7d062fdfa73b5e96b0483f90e6c40a9db53e.tar.gz |
Move assert helper as well
Diffstat (limited to 'test/harness')
-rw-r--r-- | test/harness/assert.js | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/test/harness/assert.js b/test/harness/assert.js deleted file mode 100644 index 2c1c884a3..000000000 --- a/test/harness/assert.js +++ /dev/null @@ -1,64 +0,0 @@ -function assert(mustBeTrue, message) { - if (mustBeTrue === true) { - return; - } - - if (message === undefined) { - message = 'Expected true but got ' + String(truthy); - } - $ERROR(message); -} - -assert._isSameValue = function (a, b) { - if (a === b) { - // Handle +/-0 vs. -/+0 - return a !== 0 || 1 / a === 1 / b; - } - - // Handle NaN vs. NaN - return a !== a && b !== b; -}; - -assert.sameValue = function (actual, expected, message) { - if (assert._isSameValue(actual, expected)) { - return; - } - - if (message === undefined) { - message = 'Expected SameValue(' + String(actual) + ', ' + String(expected) + ') to be true'; - } - $ERROR(message); -}; - -assert.notSameValue = function (actual, unexpected, message) { - if (!assert._isSameValue(actual, unexpected)) { - return; - } - - if (message === undefined) { - message = 'Expected SameValue(' + String(actual) + ', ' + String(unexpected) + ') to be false'; - } - $ERROR(message); -}; - -assert.throws = function (expectedErrorConstructor, func) { - if (func === undefined) { - $ERROR('assert.throws requires two arguments: the error constructor and a function to run'); - return; - } - - 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); - } - return; - } - - $ERROR('Expected a ' + expectedErrorConstructor.name + ' to be thrown but no exception was thrown at all'); -}; |