diff options
Diffstat (limited to 'test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js')
-rw-r--r-- | test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js new file mode 100644 index 000000000..2fcc7e385 --- /dev/null +++ b/test/built-ins/Boolean/prototype/toString/S15.6.4.2_A1_T2.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: > + toString: If this boolean value is true, then the string "true" + is returned, otherwise, this boolean value must be false, and the string + "false" is returned +es5id: 15.6.4.2_A1_T2 +description: with some argument +includes: [$FAIL.js] +---*/ + +//CHECK#1 +try { + (Boolean.prototype.toString(true) !== "false"); + $FAIL('#1: "(Boolean.prototype.toString(true) !== "false");" lead to throwing exception. Actual: '+(Boolean.prototype.toString(true) !== "false")); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: "(Boolean.prototype.toString(true) !== "false")" lead to throwing exception. Exception is instance of TypeError. Actual: exception is '+e); + } +} + +//CHECK#2 +if((new Boolean()).toString(true) !== "false"){ + $ERROR('#2: (new Boolean()).toString(true) === "false"'); +} + +//CHECK#3 +if((new Boolean(false)).toString(true) !== "false"){ + $ERROR('#3: (new Boolean(false)).toString(true) === "false"'); +} + +//CHECK#4 +if((new Boolean(true)).toString(false) !== "true"){ + $ERROR('#4: (new Boolean(true)).toString(false) === "true"'); +} + +//CHECK#5 +if((new Boolean(1)).toString(false) !== "true"){ + $ERROR('#5: (new Boolean(1)).toString(false) === "true"'); +} + +//CHECK#6 +if((new Boolean(0)).toString(true) !== "false"){ + $ERROR('#6: (new Boolean(0)).toString(true) === "false"'); +} + +//CHECK#7 +if((new Boolean(new Object())).toString(false) !== "true"){ + $ERROR('#7: (new Boolean(new Object())).toString(false) === "true"'); +} |