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