Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/S9.9_A3.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 ToObject conversion from Boolean: create a new Boolean object
7 whose [[value]] property is set to the value of the boolean
8 es5id: 9.9_A3
9 description: Trying to convert from Boolean to Object
10 ---*/
11
12 // CHECK#1
13 if (Object(true).valueOf() !== true) {
14 $ERROR('#1: Object(true).valueOf() === true. Actual: ' + (Object(true).valueOf()));
15 }
16
17 // CHECK#2
18 if (typeof Object(true) !== "object") {
19 $ERROR('#2: typeof Object(true) === "object". Actual: ' + (typeof Object(true)));
20 }
21
22 // CHECK#3
23 if (Object(true).constructor.prototype !== Boolean.prototype) {
24 $ERROR('#3: Object(true).constructor.prototype === Boolean.prototype. Actual: ' + (Object(true).constructor.prototype));
25 }
26
27 // CHECK#4
28 if (Object(false).valueOf() !== false) {
29 $ERROR('#4: Object(false).valueOf() === false. Actual: ' + (Object(false).valueOf()));
30 }
31
32 // CHECK#5
33 if (typeof Object(false) !== "object") {
34 $ERROR('#5: typeof Object(false) === "object". Actual: ' + (typeof Object(false)));
35 }
36
37 // CHECK#6
38 if (Object(false).constructor.prototype !== Boolean.prototype) {
39 $ERROR('#6: Object(false).constructor.prototype === Boolean.prototype. Actual: ' + (Object(false).constructor.prototype));
40 }