Debian Codegraph @

js/src/tests/test262/language/statements/for-in/S12.6.4_A3.js

raw
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 The production IterationStatement: "for (var VariableDeclarationNoIn in
7 Expression) Statement"
8 es5id: 12.6.4_A3
9 description: >
10 Using an array as an Expression is appropriate. Here Expression is
11 an array of numbers. Eval is used
12 ---*/
13
14 var __str, __evaluated, arr, ind;
15 __str="";
16
17 __evaluated = eval("for(ind in (arr=[2,1,4,3]))__str+=arr[ind]");
18
19 //////////////////////////////////////////////////////////////////////////////
20 //CHECK#1
21 if (__evaluated !== __str) {
22 throw new Test262Error('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated );
23 }
24 //
25 //////////////////////////////////////////////////////////////////////////////
26
27 //////////////////////////////////////////////////////////////////////////////
28 //CHECK#2
29 if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) {
30 throw new Test262Error('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)');
31 }
32 //
33 //////////////////////////////////////////////////////////////////////////////
34
35 reportCompare(0, 0);