Debian Codegraph @

js/src/tests/test262/language/function-code/S10.2.1_A4_T1.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 Function declaration in function code - If the variable object
7 already has a property with the name of Function Identifier, replace its
8 value and attributes. Semantically, this step must follow the creation of
9 FormalParameterList properties
10 es5id: 10.2.1_A4_T1
11 description: Checking existence of a function with passed parameter
12 flags: [noStrict]
13 ---*/
14
15 //CHECK#1
16 function f1(x){
17 return x;
18
19 function x(){
20 return 7;
21 }
22 }
23 if(!(f1().constructor.prototype === Function.prototype)){
24 throw new Test262Error('#1: f1() returns function');
25 }
26
27 //CHECK#2
28 function f2(x){
29 return typeof x;
30
31 function x(){
32 return 7;
33 }
34 }
35 if(!(f2() === "function")){
36 throw new Test262Error('#2: f2() === "function"');
37 }
38
39 //CHECK#3
40 function f3() {
41 return typeof arguments;
42 function arguments() {
43 return 7;
44 }
45 }
46 if (!(f3() === "function")){
47 throw new Test262Error('#3: f3() === "function"');
48 }
49
50 reportCompare(0, 0);