| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Returns a boolean value (not a Boolean object) computed by |
| 7 |
ToBoolean(value) |
| 8 |
esid: sec-terms-and-definitions-boolean-value |
| 9 |
es5id: 15.6.1.1_A1_T3 |
| 10 |
description: Used various string values as argument |
| 11 |
---*/ |
| 12 |
|
| 13 |
//CHECK#1 |
| 14 |
if (typeof Boolean("0") !== "boolean") { |
| 15 |
$ERROR('#1.1: typeof Boolean("0") should be "boolean", actual is "' + typeof Boolean("0") + '"'); |
| 16 |
} |
| 17 |
if (Boolean("0") !== true) { |
| 18 |
$ERROR('#1.2: Boolean("0") should be true'); |
| 19 |
} |
| 20 |
|
| 21 |
//CHECK#2 |
| 22 |
if (typeof Boolean("-1") !== "boolean") { |
| 23 |
$ERROR('#2.1: typeof Boolean("-1") should be "boolean", actual is "' + typeof Boolean("-1") + '"'); |
| 24 |
} |
| 25 |
if (Boolean("-1") !== true) { |
| 26 |
$ERROR('#2.2: Boolean("-1") should be true'); |
| 27 |
} |
| 28 |
|
| 29 |
//CHECK#3 |
| 30 |
if (typeof Boolean("1") !== "boolean") { |
| 31 |
$ERROR('#3.1: typeof Boolean("1") should be "boolean", actual is "' + typeof Boolean("1") + '"'); |
| 32 |
} |
| 33 |
if (Boolean("1") !== true) { |
| 34 |
$ERROR('#3.2: Boolean("1") should be true'); |
| 35 |
} |
| 36 |
|
| 37 |
//CHECK#4 |
| 38 |
if (typeof Boolean("false") !== "boolean") { |
| 39 |
$ERROR('#4.1: typeof Boolean("false") should be "boolean", actual is "' + typeof Boolean("false") + '"'); |
| 40 |
} |
| 41 |
if (Boolean("false") !== true) { |
| 42 |
$ERROR('#4.2: Boolean("false") should be true'); |
| 43 |
} |
| 44 |
|
| 45 |
//CHECK#5 |
| 46 |
if (typeof Boolean("true") !== "boolean") { |
| 47 |
$ERROR('#5.1: typeof Boolean("true") should be "boolean", actual is "' + typeof Boolean("true") + '"'); |
| 48 |
} |
| 49 |
if (Boolean("true") !== true) { |
| 50 |
$ERROR('#5.2: Boolean("true") should be true'); |
| 51 |
} |