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