Debian Codegraph @

js/src/tests/test262/language/statements/for/S12.6.3_A2.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 While evaluating "for (ExpressionNoIn; Expression; Expression)
7 Statement", ExpressionNoIn is evaulated first
8 es5id: 12.6.3_A2
9 description: Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn
10 ---*/
11
12 //////////////////////////////////////////////////////////////////////////////
13 //CHECK#1
14 try {
15 for((function(){throw "NoInExpression";})(); (function(){throw "FirstExpression";})(); (function(){throw "SecondExpression";})()) {
16 var in_for = "reached";
17 }
18 throw new Test262Error('#1: (function(){throw "NoInExpression";})() lead to throwing exception');
19 } catch (e) {
20 if (e !== "NoInExpression") {
21 throw new Test262Error('#1: When for (ExpressionNoIn ; Expression ; Expression) Statement is evaluated ExpressionNoIn evaluates first');
22 }
23 }
24 //
25 //////////////////////////////////////////////////////////////////////////////
26
27 //////////////////////////////////////////////////////////////////////////////
28 //CHECK#2
29 if (in_for !== undefined) {
30 throw new Test262Error('#2: in_for === undefined. Actual: in_for ==='+ in_for );
31 }
32 //
33 //////////////////////////////////////////////////////////////////////////////
34
35 reportCompare(0, 0);