diff options
author | Mike Pennisi <mike@mikepennisi.com> | 2015-06-16 12:35:27 -0400 |
---|---|---|
committer | Mike Pennisi <mike@mikepennisi.com> | 2015-06-16 12:55:56 -0400 |
commit | 57f3466cf718e017fcbeea9de72404885ad05219 (patch) | |
tree | 93077ee43ef38d375da96f4cea99be41e103a7ff /test/built-ins/String/prototype/slice | |
parent | e4aac334b87bf0c22a91205bb36ea28b02dcb8a2 (diff) | |
download | qtdeclarative-testsuites-57f3466cf718e017fcbeea9de72404885ad05219.tar.gz |
Fix tautological pattern in tests
In neglecting to assert the type of error thrown (or that any error was
thrown at all), these tests cannot fail. Refactor the tests to use the
`assert.throws` helper method, which takes these details into
consideration.
Diffstat (limited to 'test/built-ins/String/prototype/slice')
-rw-r--r-- | test/built-ins/String/prototype/slice/S15.5.4.13_A7.js | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/test/built-ins/String/prototype/slice/S15.5.4.13_A7.js b/test/built-ins/String/prototype/slice/S15.5.4.13_A7.js index 7246b6d8f..deba84f20 100644 --- a/test/built-ins/String/prototype/slice/S15.5.4.13_A7.js +++ b/test/built-ins/String/prototype/slice/S15.5.4.13_A7.js @@ -5,15 +5,10 @@ info: String.prototype.slice can't be used as constructor es5id: 15.5.4.13_A7 description: Checking if creating the String.prototype.slice object fails -includes: - - $PRINT.js ---*/ -var __FACTORY = String.prototype.slice; +var FACTORY = String.prototype.slice; -try { - var __instance = new __FACTORY; - $ERROR('#1: __FACTORY = String.prototype.slice; "__instance = new __FACTORY" lead to throwing exception'); -} catch (e) { - $PRINT(e); -} +assert.throws(TypeError, function() { + new FACTORY; +}); |