Debian Codegraph @

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