S12.5_A5.js (1407B)
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 FunctionDeclaration inside the "if" Expression is evaluated as true and 7 function will not be declarated 8 es5id: 12.5_A5 9 description: > 10 The "if" Expression is "function __func(){throw 11 "FunctionExpression";}" 12 ---*/ 13 14 ////////////////////////////////////////////////////////////////////////////// 15 //CHECK#1 16 try { 17 __func=__func; 18 throw new Test262Error('#1: "__func=__func" lead to throwing exception'); 19 } catch (e) { 20 ; 21 } 22 // 23 ////////////////////////////////////////////////////////////////////////////// 24 25 26 ////////////////////////////////////////////////////////////////////////////// 27 //CHECK#2 28 try { 29 if(function __func(){throw "FunctionExpression";}) (function(){throw "TrueBranch"})(); else (function(){"MissBranch"})(); 30 } catch (e) { 31 if (e !== "TrueBranch") { 32 throw new Test262Error('#2: Exception ==="TrueBranch". Actual: Exception ==='+ e); 33 } 34 } 35 // 36 ////////////////////////////////////////////////////////////////////////////// 37 38 ////////////////////////////////////////////////////////////////////////////// 39 //CHECK#3 40 try { 41 __func=__func; 42 throw new Test262Error('#3: "__func=__func" lead to throwing exception'); 43 } catch (e) { 44 ; 45 } 46 // 47 ////////////////////////////////////////////////////////////////////////////// 48 49 reportCompare(0, 0);