S12.6.4_A4.js (1264B)
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_A4 9 description: Using Object as an Expression is appropriate. Eval is used 10 ---*/ 11 12 var __str, __evaluated, hash, ind; 13 __str=""; 14 15 __evaluated = eval("for(ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]"); 16 17 ////////////////////////////////////////////////////////////////////////////// 18 //CHECK#1 19 if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) { 20 throw new Test262Error('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)'); 21 } 22 // 23 ////////////////////////////////////////////////////////////////////////////// 24 25 ////////////////////////////////////////////////////////////////////////////// 26 //CHECK#2 27 if (__str !== __evaluated) { 28 throw new Test262Error('#2: __str === __evaluated. Actual: __str ==='+ __str ); 29 } 30 // 31 ////////////////////////////////////////////////////////////////////////////// 32 33 reportCompare(0, 0);