Debian Codegraph @

js/src/tests/test262/built-ins/Boolean/S15.6.1.1_A1_T3.js

raw
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 info: |
5 Returns a boolean value (not a Boolean object) computed by
6 ToBoolean(value)
7 esid: sec-terms-and-definitions-boolean-value
8 description: Used various string values as argument
9 ---*/
10
11 assert.sameValue(typeof Boolean("0"), "boolean", 'The value of `typeof Boolean("0")` is expected to be "boolean"');
12 assert.sameValue(Boolean("0"), true, 'Boolean("0") must return true');
13 assert.sameValue(typeof Boolean("-1"), "boolean", 'The value of `typeof Boolean("-1")` is expected to be "boolean"');
14 assert.sameValue(Boolean("-1"), true, 'Boolean("-1") must return true');
15 assert.sameValue(typeof Boolean("1"), "boolean", 'The value of `typeof Boolean("1")` is expected to be "boolean"');
16 assert.sameValue(Boolean("1"), true, 'Boolean("1") must return true');
17
18 assert.sameValue(
19 typeof Boolean("false"),
20 "boolean",
21 'The value of `typeof Boolean("false")` is expected to be "boolean"'
22 );
23
24 assert.sameValue(Boolean("false"), true, 'Boolean("false") must return true');
25
26 assert.sameValue(
27 typeof Boolean("true"),
28 "boolean",
29 'The value of `typeof Boolean("true")` is expected to be "boolean"'
30 );
31
32 assert.sameValue(Boolean("true"), true, 'Boolean("true") must return true');
33
34 reportCompare(0, 0);