Debian Codegraph @

js/src/tests/test262/built-ins/Boolean/S15.6.1.1_A1_T4.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 /*---
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 description: Used various undefined values and null as argument
10 ---*/
11
12 assert.sameValue(
13 typeof Boolean(undefined),
14 "boolean",
15 'The value of `typeof Boolean(undefined)` is expected to be "boolean"'
16 );
17
18 assert.sameValue(Boolean(undefined), false, 'Boolean(undefined) must return false');
19
20 assert.sameValue(
21 typeof Boolean(void 0),
22 "boolean",
23 'The value of `typeof Boolean(void 0)` is expected to be "boolean"'
24 );
25
26 assert.sameValue(Boolean(void 0), false, 'Boolean(void 0) must return false');
27
28 assert.sameValue(
29 typeof Boolean(function() {}()),
30 "boolean",
31 'The value of `typeof Boolean(function() {}())` is expected to be "boolean"'
32 );
33
34 assert.sameValue(Boolean(function() {}()), false, 'Boolean(function() {}()) must return false');
35 assert.sameValue(typeof Boolean(null), "boolean", 'The value of `typeof Boolean(null)` is expected to be "boolean"');
36 assert.sameValue(Boolean(null), false, 'Boolean(null) must return false');
37 assert.sameValue(typeof Boolean(x), "boolean", 'The value of `typeof Boolean(x)` is expected to be "boolean"');
38 assert.sameValue(Boolean(x), false, 'Boolean() must return false');
39 var x;
40
41 reportCompare(0, 0);