Debian Codegraph @

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