| 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 |
esid: sec-array-len |
| 6 |
info: | |
| 7 |
If the argument len is not a Number, then the length property of |
| 8 |
the newly constructed object is set to 1 and the 0 property of |
| 9 |
the newly constructed object is set to len |
| 10 |
es5id: 15.4.2.2_A2.3_T1 |
| 11 |
description: Checking for null and undefined |
| 12 |
---*/ |
| 13 |
|
| 14 |
var x = new Array(null); |
| 15 |
|
| 16 |
//CHECK#1 |
| 17 |
if (x.length !== 1) { |
| 18 |
$ERROR('#1: var x = new Array(null); x.length === 1. Actual: ' + (x.length)); |
| 19 |
} |
| 20 |
|
| 21 |
//CHECK#2 |
| 22 |
if (x[0] !== null) { |
| 23 |
$ERROR('#2: var x = new Array(null); x[0] === null. Actual: ' + (x[0])); |
| 24 |
} |
| 25 |
|
| 26 |
var x = new Array(undefined); |
| 27 |
|
| 28 |
//CHECK#3 |
| 29 |
if (x.length !== 1) { |
| 30 |
$ERROR('#3: var x = new Array(undefined); x.length === 1. Actual: ' + (x.length)); |
| 31 |
} |
| 32 |
|
| 33 |
//CHECK#4 |
| 34 |
if (x[0] !== undefined) { |
| 35 |
$ERROR('#4: var x = new Array(undefined); x[0] === undefined. Actual: ' + (x[0])); |
| 36 |
} |