js/src/tests/test262/ch14/14.0/S14_A2.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:e98343a46657
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 * FunctionDeclaration cannot be localed inside an Expression
6 *
7 * @path ch14/14.0/S14_A2.js
8 * @description Declaring a function within an "if" Expression
9 */
10
11 //////////////////////////////////////////////////////////////////////////////
12 //CHECK#1
13 if (typeof f !== 'undefined') {
14 $ERROR('#1: typeof f === \'undefined\'. Actual: typeof f ==='+ typeof f );
15 }
16 //
17 //////////////////////////////////////////////////////////////////////////////
18
19 //////////////////////////////////////////////////////////////////////////////
20 //CHECK#2
21 if (function f(arg){
22 if (arg===0)
23 return 1;
24 else
25 return f(arg-1)*arg;
26 }(3)!==6) {
27 $ERROR('#2: FunctionDeclaration cannot be localed inside an Expression');
28 };
29 //
30 //////////////////////////////////////////////////////////////////////////////
31

mercurial