tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S15.4.2.2_A2.2_T3.js (1330B)


      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 a Number and ToUint32(len) is not equal to len,
      8    a RangeError exception is thrown
      9 es5id: 15.4.2.2_A2.2_T3
     10 description: Use try statement. len = 1.5, Number.MAX_VALUE, Number.MIN_VALUE
     11 ---*/
     12 
     13 try {
     14  new Array(1.5);
     15  throw new Test262Error('#1.1: new Array(1.5) throw RangeError. Actual: ' + (new Array(1.5)));
     16 } catch (e) {
     17  assert.sameValue(
     18    e instanceof RangeError,
     19    true,
     20    'The result of evaluating (e instanceof RangeError) is expected to be true'
     21  );
     22 }
     23 
     24 try {
     25  new Array(Number.MAX_VALUE);
     26  throw new Test262Error('#2.1: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (new Array(Number.MAX_VALUE)));
     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  new Array(Number.MIN_VALUE);
     37  throw new Test262Error('#3.1: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (new Array(Number.MIN_VALUE)));
     38 } catch (e) {
     39  assert.sameValue(
     40    e instanceof RangeError,
     41    true,
     42    'The result of evaluating (e instanceof RangeError) is expected to be true'
     43  );
     44 }
     45 
     46 reportCompare(0, 0);