| 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 |
When Boolean is called as part of a new expression it is |
| 7 |
a constructor: it initialises the newly created object |
| 8 |
esid: sec-boolean-constructor |
| 9 |
es5id: 15.6.2.1_A1 |
| 10 |
description: Checking type of the newly created object and it value |
| 11 |
---*/ |
| 12 |
|
| 13 |
//CHECK#1 |
| 14 |
if (typeof new Boolean() !== "object") { |
| 15 |
$ERROR("#1: typeof new Boolean() === 'object'"); |
| 16 |
} |
| 17 |
|
| 18 |
//CHECK#2 |
| 19 |
if (new Boolean() === undefined) { |
| 20 |
$ERROR("#2: new Boolean() should not be undefined"); |
| 21 |
} |
| 22 |
|
| 23 |
//CHECK#3 |
| 24 |
var x3 = new Boolean(); |
| 25 |
if (typeof x3 !== "object") { |
| 26 |
$ERROR("#3: typeof new Boolean() !== 'object'"); |
| 27 |
} |
| 28 |
|
| 29 |
//CHECK#4 |
| 30 |
var x4 = new Boolean(); |
| 31 |
if (x4 === undefined) { |
| 32 |
$ERROR("#4: new Boolean() should not be undefined"); |
| 33 |
} |
| 34 |
|
| 35 |
//CHECK#5 |
| 36 |
if (typeof new Boolean(1) !== "object") { |
| 37 |
$ERROR("#5: typeof new Boolean(10) === 'object'"); |
| 38 |
} |
| 39 |
|
| 40 |
//CHECK#6 |
| 41 |
if (new Boolean(1) === undefined) { |
| 42 |
$ERROR("#6: new Boolean(1) should not be undefined"); |
| 43 |
} |
| 44 |
|
| 45 |
//CHECK#7 |
| 46 |
var x7 = new Boolean(1); |
| 47 |
if (typeof x7 !== "object") { |
| 48 |
$ERROR("#7: typeof new Boolean(1) !== 'object'"); |
| 49 |
} |
| 50 |
|
| 51 |
//CHECK#8 |
| 52 |
var x8 = new Boolean(1); |
| 53 |
if (x8 === undefined) { |
| 54 |
$ERROR("#8: new Boolean(1) should not be undefined"); |
| 55 |
} |