S14_A2.js (963B)
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: FunctionDeclaration cannot be localed inside an Expression 6 es5id: 14_A2 7 description: Declaring a function within an "if" Expression 8 ---*/ 9 10 ////////////////////////////////////////////////////////////////////////////// 11 //CHECK#1 12 if (typeof f !== 'undefined') { 13 throw new Test262Error('#1: typeof f === \'undefined\'. Actual: typeof f ==='+ typeof f ); 14 } 15 // 16 ////////////////////////////////////////////////////////////////////////////// 17 18 ////////////////////////////////////////////////////////////////////////////// 19 //CHECK#2 20 if (function f(arg){ 21 if (arg===0) 22 return 1; 23 else 24 return f(arg-1)*arg; 25 }(3)!==6) { 26 throw new Test262Error('#2: FunctionDeclaration cannot be localed inside an Expression'); 27 }; 28 // 29 ////////////////////////////////////////////////////////////////////////////// 30 31 reportCompare(0, 0);