Debian Codegraph @

js/src/tests/test262/language/statements/variable/S14_A1.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: FunctionExpression must be localed in a reacheable fragment of the program
6 es5id: 14_A1
7 description: Declaring a function within an "if" Expression
8 ---*/
9
10 var THERE = "I'm there";
11 var HERE = "I'm here";
12
13 //////////////////////////////////////////////////////////////////////////////
14 //CHECK#1
15 if ( __func !== undefined) {
16 throw new Test262Error('#1: __func === undefined. Actual: __func ==='+ __func );
17 }
18 //
19 //////////////////////////////////////////////////////////////////////////////
20
21 if (true){
22 var __func = function(){return HERE;};
23 } else {
24 var __func = function (){return THERE;};
25 };
26
27 //////////////////////////////////////////////////////////////////////////////
28 //CHECK#2
29 if (__func() !== HERE) {
30 throw new Test262Error('#2: __func() === HERE. Actual: __func() ==='+ __func() );
31 }
32 //
33 //////////////////////////////////////////////////////////////////////////////
34
35 reportCompare(0, 0);