| 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-exotic-objects-defineownproperty-p-desc |
| 6 |
info: Set the value of property length of A to Uint32(length) |
| 7 |
es5id: 15.4.5.1_A1.3_T1 |
| 8 |
description: length is object or primitve |
| 9 |
---*/ |
| 10 |
|
| 11 |
//CHECK#1 |
| 12 |
var x = []; |
| 13 |
x.length = true; |
| 14 |
if (x.length !== 1) { |
| 15 |
$ERROR('#1: x = []; x.length = true; x.length === 1. Actual: ' + (x.length)); |
| 16 |
} |
| 17 |
|
| 18 |
//CHECK#2 |
| 19 |
x = [0]; |
| 20 |
x.length = null; |
| 21 |
if (x.length !== 0) { |
| 22 |
$ERROR('#2: x = [0]; x.length = null; x.length === 0. Actual: ' + (x.length)); |
| 23 |
} |
| 24 |
|
| 25 |
//CHECK#3 |
| 26 |
x = [0]; |
| 27 |
x.length = new Boolean(false); |
| 28 |
if (x.length !== 0) { |
| 29 |
$ERROR('#3: x = [0]; x.length = new Boolean(false); x.length === 0. Actual: ' + (x.length)); |
| 30 |
} |
| 31 |
|
| 32 |
//CHECK#4 |
| 33 |
x = []; |
| 34 |
x.length = new Number(1); |
| 35 |
if (x.length !== 1) { |
| 36 |
$ERROR('#4: x = []; x.length = new Number(1); x.length === 1. Actual: ' + (x.length)); |
| 37 |
} |
| 38 |
|
| 39 |
//CHECK#5 |
| 40 |
x = []; |
| 41 |
x.length = "1"; |
| 42 |
if (x.length !== 1) { |
| 43 |
$ERROR('#5: x = []; x.length = "1"; x.length === 1. Actual: ' + (x.length)); |
| 44 |
} |
| 45 |
|
| 46 |
//CHECK#6 |
| 47 |
x = []; |
| 48 |
x.length = new String("1"); |
| 49 |
if (x.length !== 1) { |
| 50 |
$ERROR('#6: x = []; x.length = new String("1"); x.length === 1. Actual: ' + (x.length)); |
| 51 |
} |