S12.6.3_A5.js (1493B)
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 "in"-expression wrapped into "eval" statement is allowed as a 7 ExpressionNoIn in "for (ExpressionNoIn; FirstExpression; 8 SecondExpression) Statement" IterationStatement 9 es5id: 12.6.3_A5 10 description: Using eval "for(eval("i in arr");1;)" 11 ---*/ 12 13 var arr, i; 14 15 arr = [1,2,3,4,5]; 16 i = 1; 17 ////////////////////////////////////////////////////////////////////////////// 18 //CHECK#1 19 try { 20 for(eval("i in arr");1;) {break;}; 21 } catch (e) { 22 throw new Test262Error('#1.1: for(eval("i in arr");1;) {break;}; does not lead to throwing exception'); 23 } 24 // 25 ////////////////////////////////////////////////////////////////////////////// 26 27 ////////////////////////////////////////////////////////////////////////////// 28 //CHECK#2 29 try { 30 for(eval("var i = 1 in arr");1;) {break;}; 31 } catch (e) { 32 throw new Test262Error('#2.1: for(eval("var i = 1 in arr");1;) {break;}; does not lead to throwing exception'); 33 } 34 // 35 ////////////////////////////////////////////////////////////////////////////// 36 37 ////////////////////////////////////////////////////////////////////////////// 38 //CHECK#3 39 try { 40 for(eval("1 in arr");1;) {break;}; 41 } catch (e) { 42 throw new Test262Error('#3.1: for(eval("1 in arr");1;) {break;}; does not lead to throwing exception'); 43 } 44 // 45 ////////////////////////////////////////////////////////////////////////////// 46 47 reportCompare(0, 0);