Debian Codegraph @

js/src/tests/test262/language/statements/if/S12.5_A4.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 When the production "IfStatement: if ( Expression ) Statement else
7 Statement" is evaluated, Statement(s) is(are) evaluated second
8 es5id: 12.5_A4
9 description: The first statement is "(function(){throw "instatement"})()"
10 ---*/
11
12 //////////////////////////////////////////////////////////////////////////////
13 //CHECK#1
14 try {
15 if (true) (function(){throw "instatement"})();
16 throw new Test262Error("#1 failed")
17 } catch (e) {
18 if (e !== "instatement") {
19 throw new Test262Error('#1: Exception === "instatement". Actual: Exception ==='+ e);
20 }
21 }
22 //
23 //////////////////////////////////////////////////////////////////////////////
24
25 //////////////////////////////////////////////////////////////////////////////
26 //CHECK#2
27 try {
28 if (false) (function(){throw "truebranch"})(); (function(){throw "missbranch"})();
29 throw new Test262Error("#2 failed")
30 } catch (e) {
31 if (e !== "missbranch") {
32 throw new Test262Error('#2: Exception === "missbranch". Actual: Exception ==='+ e);
33 }
34 }
35 //
36 //////////////////////////////////////////////////////////////////////////////
37
38 reportCompare(0, 0);