Debian Codegraph @

js/src/tests/test262/language/statements/for-in/S12.6.4_A5.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_A5
9 description: >
10 Using hierarchical Object as an Expression is appropriate. The
11 depth is two
12 ---*/
13
14 var __hash__map, __arr, __key, __ind;
15
16 __hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}};
17
18 __arr = "";
19
20 for(__key in __hash__map){
21 for (__ind in __hash__map[__key]){
22 __arr+=("" + __ind + __hash__map[__key][__ind]);
23 }
24 }
25
26 if(!(
27 (__arr.indexOf("aa1")!==-1)&
28 (__arr.indexOf("ab2")!==-1)&
29 (__arr.indexOf("ac3")!==-1)&
30 (__arr.indexOf("ad4")!==-1)&
31 (__arr.indexOf("ba1")!==-1)&
32 (__arr.indexOf("bb2")!==-1)&
33 (__arr.indexOf("bc3")!==-1)&
34 (__arr.indexOf("bd4")!==-1)&
35 (__arr.indexOf("ca1")!==-1)&
36 (__arr.indexOf("cb2")!==-1)&
37 (__arr.indexOf("cc3")!==-1)&
38 (__arr.indexOf("cd4")!==-1)&
39 (__arr.indexOf("da1")!==-1)&
40 (__arr.indexOf("db2")!==-1)&
41 (__arr.indexOf("dc3")!==-1)&
42 (__arr.indexOf("dd4")!==-1)
43 )) throw new Test262Error('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard');
44
45 reportCompare(0, 0);