S13.2.1_A7_T3.js (1668B)
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 [[Call]] property for a Function object F is called, the following steps are taken: 7 2. Evaluate F's FunctionBody; 8 if Result.type is returned then Result.value is returned too 9 es5id: 13.2.1_A7_T3 10 description: Returning number. Declaring a function with "function __func()" 11 flags: [noStrict] 12 ---*/ 13 14 function __func(){ 15 x = 1; 16 return x; 17 } 18 19 ////////////////////////////////////////////////////////////////////////////// 20 //CHECK# 21 try { 22 x=x; 23 throw new Test262Error('#0: "x=x" lead to throwing exception'); 24 } catch (e) { 25 if (e instanceof Test262Error) throw e; 26 } 27 // 28 ////////////////////////////////////////////////////////////////////////////// 29 30 ////////////////////////////////////////////////////////////////////////////// 31 //CHECK#1 32 try{ 33 var __x=__func(); 34 } catch(e){ 35 throw new Test262Error('#1: var __x=__func() does not lead to throwing exception. Actual: exception is '+e); 36 } 37 // 38 ////////////////////////////////////////////////////////////////////////////// 39 40 ////////////////////////////////////////////////////////////////////////////// 41 //CHECK#2 42 if (__x !== 1) { 43 throw new Test262Error('#2: __x === 1. Actual: __x ==='+__x); 44 } 45 // 46 ////////////////////////////////////////////////////////////////////////////// 47 48 ////////////////////////////////////////////////////////////////////////////// 49 //CHECK#3 50 if (x !== 1) { 51 throw new Test262Error('#3: x === 1. Actual: x ==='+x); 52 } 53 // 54 ////////////////////////////////////////////////////////////////////////////// 55 56 reportCompare(0, 0);