diff options
Diffstat (limited to 'test/built-ins/String/prototype/search/S15.5.4.12_A7.js')
-rw-r--r-- | test/built-ins/String/prototype/search/S15.5.4.12_A7.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/built-ins/String/prototype/search/S15.5.4.12_A7.js b/test/built-ins/String/prototype/search/S15.5.4.12_A7.js new file mode 100644 index 000000000..9a7faef37 --- /dev/null +++ b/test/built-ins/String/prototype/search/S15.5.4.12_A7.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.search can't be used as constructor +es5id: 15.5.4.12_A7 +description: Checking if creating the String.prototype.search object fails +includes: + - $PRINT.js + - $FAIL.js +---*/ + +var __FACTORY = String.prototype.search; + +try { + var __instance = new __FACTORY; + $FAIL('#1: __FACTORY = String.prototype.search; "__instance = new __FACTORY" lead to throwing exception'); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.1: __FACTORY = String.prototype.search; "__instance = new __FACTORY" throw a TypeError. Actual: ' + (e)); + } + $PRINT(e); +} |