Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.1_A9_T2.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: |
6 When the [[Call]] property for a Function object is called,
7 the body is evaluated and if evaluation result has type "return" its value is not defined, then "undefined" is returned
8 es5id: 13.2.1_A9_T2
9 description: >
10 Using "return" with no expression. Declaring a function with "var
11 __func = function()"
12 ---*/
13
14 var x;
15
16 var __func = function(){
17 x = 1;
18 return;
19 }
20
21 //////////////////////////////////////////////////////////////////////////////
22 //CHECK#1
23 if (__func() !== undefined) {
24 throw new Test262Error('#1: __func() === undefined. Actual: __func() ==='+__func());
25 };
26 //
27 //////////////////////////////////////////////////////////////////////////////
28
29 //////////////////////////////////////////////////////////////////////////////
30 //CHECK#2
31 if (x!==1) {
32 throw new Test262Error('#2: x === 1. Actual: x === '+x);
33 }
34 //
35 //////////////////////////////////////////////////////////////////////////////
36
37 reportCompare(0, 0);