S15.4.5.1_A1.1_T2.js (1697B)
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 try { 12 var x = []; 13 x.length = NaN; 14 throw new Test262Error('#1.1: x = []; x.length = NaN throw RangeError. Actual: x.length === ' + (x.length)); 15 } catch (e) { 16 assert.sameValue( 17 e instanceof RangeError, 18 true, 19 'The result of evaluating (e instanceof RangeError) is expected to be true' 20 ); 21 } 22 23 try { 24 x = []; 25 x.length = Number.POSITIVE_INFINITY; 26 throw new Test262Error('#2.1: x = []; x.length = Number.POSITIVE_INFINITY throw RangeError. Actual: x.length === ' + (x.length)); 27 } catch (e) { 28 assert.sameValue( 29 e instanceof RangeError, 30 true, 31 'The result of evaluating (e instanceof RangeError) is expected to be true' 32 ); 33 } 34 35 try { 36 x = []; 37 x.length = Number.NEGATIVE_INFINITY; 38 throw new Test262Error('#3.1: x = []; x.length = Number.NEGATIVE_INFINITY throw RangeError. Actual: x.length === ' + (x.length)); 39 } catch (e) { 40 assert.sameValue( 41 e instanceof RangeError, 42 true, 43 'The result of evaluating (e instanceof RangeError) is expected to be true' 44 ); 45 } 46 47 try { 48 x = []; 49 x.length = undefined; 50 throw new Test262Error('#4.1: x = []; x.length = undefined throw RangeError. Actual: x.length === ' + (x.length)); 51 } catch (e) { 52 assert.sameValue( 53 e instanceof RangeError, 54 true, 55 'The result of evaluating (e instanceof RangeError) is expected to be true' 56 ); 57 } 58 59 reportCompare(0, 0);