aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/sputnik_converted/11_Expressions/11.1_Primary_Expressions/11.1.4_Array_Initialiser/S11.1.4_A1.7.js
blob: c41c31597446002f72e33a27b48be74bf96a38b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S11.1.4_A1.7;
* @section: 11.1.4;
* @assertion: Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision, AssignmentExpression ];
* @description: Checking various properteis and contents of the array defined with "var array = [1,2,,4,5]";
*/


// Converted for Test262 from original Sputnik source

ES5Harness.registerTest( {
id: "S11.1.4_A1.7",

path: "TestCases/11_Expressions/11.1_Primary_Expressions/11.1.4_Array_Initialiser/S11.1.4_A1.7.js",

assertion: "Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision, AssignmentExpression ]",

description: "Checking various properteis and contents of the array defined with \"var array = [1,2,,4,5]\"",

test: function testcase() {
   var array = [1,2,,4,5];

//CHECK#1
if (typeof array !== "object") {
  $ERROR('#1: var array = [1,2,,4,5]; typeof array === "object". Actual: ' + (typeof array));
}

//CHECK#2
if (array instanceof Array !== true) {
  $ERROR('#2: var array = [1,2,,4,5]; array instanceof Array === true');
}

//CHECK#3
if (array.toString !== Array.prototype.toString) {
  $ERROR('#3: var array = [1,2,,4,5]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}

//CHECK#4
if (array.length !== 5) {
  $ERROR('#4: var array = [1,2,,4,5]; array.length === 5. Actual: ' + (array.length));
}

//CHECK#5
if (array[0] !== 1) {
  $ERROR('#5: var array = [1,2,,4,5]; array[0] === 1. Actual: ' + (array[0]));
}

//CHECK#6
if (array[1] !== 2) {
  $ERROR('#6: var array = [1,2,,4,5]; array[1] === 2. Actual: ' + (array[1]));
}

//CHECK#7
if (array[2] !== undefined) {
  $ERROR('#7: var array = [1,2,,4,5]; array[2] === undefined. Actual: ' + (array[2]));
}

//CHECK#8
if (array[3] !== 4) {
  $ERROR('#8: var array = [1,2,,4,5]; array[3] === 4. Actual: ' + (array[3]));
}

//CHECK#9
if (array[4] !== 5) {
  $ERROR('#9: var array = [1,2,,4,5]; array[4] === 5. Actual: ' + (array[4]));
}

 }
});