tor-browser

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

S11.1.4_A1.7.js (1735B)


      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 info: |
      6    Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision,
      7    AssignmentExpression ]
      8 es5id: 11.1.4_A1.7
      9 description: >
     10    Checking various properteis and contents of the array defined with
     11    "var array = [1,2,,4,5]"
     12 ---*/
     13 
     14 var array = [1,2,,4,5];
     15 
     16 //CHECK#1
     17 if (typeof array !== "object") {
     18  throw new Test262Error('#1: var array = [1,2,,4,5]; typeof array === "object". Actual: ' + (typeof array));
     19 }
     20 
     21 //CHECK#2
     22 if (array instanceof Array !== true) {
     23  throw new Test262Error('#2: var array = [1,2,,4,5]; array instanceof Array === true');
     24 }
     25 
     26 //CHECK#3
     27 if (array.toString !== Array.prototype.toString) {
     28  throw new Test262Error('#3: var array = [1,2,,4,5]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
     29 }
     30 
     31 //CHECK#4
     32 if (array.length !== 5) {
     33  throw new Test262Error('#4: var array = [1,2,,4,5]; array.length === 5. Actual: ' + (array.length));
     34 }
     35 
     36 //CHECK#5
     37 if (array[0] !== 1) {
     38  throw new Test262Error('#5: var array = [1,2,,4,5]; array[0] === 1. Actual: ' + (array[0]));
     39 }
     40 
     41 //CHECK#6
     42 if (array[1] !== 2) {
     43  throw new Test262Error('#6: var array = [1,2,,4,5]; array[1] === 2. Actual: ' + (array[1]));
     44 }
     45 
     46 //CHECK#7
     47 if (array[2] !== undefined) {
     48  throw new Test262Error('#7: var array = [1,2,,4,5]; array[2] === undefined. Actual: ' + (array[2]));
     49 }
     50 
     51 //CHECK#8
     52 if (array[3] !== 4) {
     53  throw new Test262Error('#8: var array = [1,2,,4,5]; array[3] === 4. Actual: ' + (array[3]));
     54 }
     55 
     56 //CHECK#9
     57 if (array[4] !== 5) {
     58  throw new Test262Error('#9: var array = [1,2,,4,5]; array[4] === 5. Actual: ' + (array[4]));
     59 }
     60 
     61 reportCompare(0, 0);