| 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: If ToUint32(length) !== ToNumber(length), throw RangeError |
| 7 |
es5id: 15.4.5.1_A1.1_T2 |
| 8 |
description: length in [NaN, Infinity, -Infinity, undefined] |
| 9 |
---*/ |
| 10 |
|
| 11 |
//CHECK#1 |
| 12 |
try { |
| 13 |
var x = []; |
| 14 |
x.length = NaN; |
| 15 |
$ERROR('#1.1: x = []; x.length = NaN throw RangeError. Actual: x.length === ' + (x.length)); |
| 16 |
} catch (e) { |
| 17 |
if ((e instanceof RangeError) !== true) { |
| 18 |
$ERROR('#1.2: x = []; x.length = NaN throw RangeError. Actual: ' + (e)); |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
//CHECK#2 |
| 23 |
try { |
| 24 |
x = []; |
| 25 |
x.length = Number.POSITIVE_INFINITY; |
| 26 |
$ERROR('#2.1: x = []; x.length = Number.POSITIVE_INFINITY throw RangeError. Actual: x.length === ' + (x.length)); |
| 27 |
} catch (e) { |
| 28 |
if ((e instanceof RangeError) !== true) { |
| 29 |
$ERROR('#2.2: x = []; x.length = Number.POSITIVE_INFINITY throw RangeError. Actual: ' + (e)); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
//CHECK#3 |
| 34 |
try { |
| 35 |
x = []; |
| 36 |
x.length = Number.NEGATIVE_INFINITY; |
| 37 |
$ERROR('#3.1: x = []; x.length = Number.NEGATIVE_INFINITY throw RangeError. Actual: x.length === ' + (x.length)); |
| 38 |
} catch (e) { |
| 39 |
if ((e instanceof RangeError) !== true) { |
| 40 |
$ERROR('#3.2: x = []; x.length = Number.NEGATIVE_INFINITY throw RangeError. Actual: ' + (e)); |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
//CHECK#4 |
| 45 |
try { |
| 46 |
x = []; |
| 47 |
x.length = undefined; |
| 48 |
$ERROR('#4.1: x = []; x.length = undefined throw RangeError. Actual: x.length === ' + (x.length)); |
| 49 |
} catch (e) { |
| 50 |
if ((e instanceof RangeError) !== true) { |
| 51 |
$ERROR('#4.2: x = []; x.length = undefined throw RangeError. Actual: ' + (e)); |
| 52 |
} |
| 53 |
} |