Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/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 es5id: 15.6.1.1_A1_T4
10 description: Used various undefined values and null as argument
11 ---*/
12
13 //CHECK#1
14 if (typeof Boolean(undefined) !== "boolean") {
15 $ERROR('#1.1: typeof Boolean(undefined) should be "boolean", actual is "' + typeof Boolean(undefined) + '"');
16 }
17 if (Boolean(undefined) !== false) {
18 $ERROR('#1.2: Boolean(undefined) should be false');
19 }
20
21 //CHECK#2
22 if (typeof Boolean(void 0) !== "boolean") {
23 $ERROR('#2.1: typeof Boolean(void 0) should be "boolean", actual is "' + typeof Boolean(void 0) + '"');
24 }
25 if (Boolean(void 0) !== false) {
26 $ERROR('#2.2: Boolean(void 0) should be false');
27 }
28
29 //CHECK#3
30 if (typeof Boolean(function() {}()) !== "boolean") {
31 $ERROR('#3.1: typeof Boolean(function(){}()) should be "boolean", actual is "' + typeof Boolean(function() {}()) + '"');
32 }
33 if (Boolean(function() {}()) !== false) {
34 $ERROR('#3.2: Boolean(function(){}()) should be false');
35 }
36
37 //CHECK#4
38 if (typeof Boolean(null) !== "boolean") {
39 $ERROR('#4.1: typeof Boolean(null) should be "boolean", actual is "' + typeof Boolean(null) + '"');
40 }
41 if (Boolean(null) !== false) {
42 $ERROR('#4.2: Boolean(null) should be false');
43 }
44
45 //CHECK#5
46 if (typeof Boolean(x) !== "boolean") {
47 $ERROR('#5.1: var x; typeof Boolean(x) should be "boolean", actual is "' + typeof Boolean(x) + '"');
48 }
49 if (Boolean(x) !== false) {
50 $ERROR('#5.2: var x; Boolean(x) should be false');
51 }
52 var x;