Debian Codegraph @

js/src/tests/test262/language/arguments-object/S10.6_A6.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 The initial value of the created property length is the number
7 of actual parameter values supplied by the caller
8 es5id: 10.6_A6
9 description: Create function, that returned arguments.length
10 ---*/
11
12 function f1(){
13 return arguments.length;
14 }
15
16 //CHECK#1
17 if(!(f1() === 0)){
18 throw new Test262Error('#1: argument.length === 0');
19 }
20
21 //CHECK#2
22 if(!(f1(0) === 1)){
23 throw new Test262Error('#2: argument.length === 1');
24 }
25
26 //CHECK#3
27 if(!(f1(0, 1) === 2)){
28 throw new Test262Error('#3: argument.length === 2');
29 }
30
31 //CHECK#4
32 if(!(f1(0, 1, 2) === 3)){
33 throw new Test262Error('#4: argument.length === 3');
34 }
35
36 //CHECK#5
37 if(!(f1(0, 1, 2, 3) === 4)){
38 throw new Test262Error('#5: argument.length === 4');
39 }
40
41 var f2 = function(){return arguments.length;};
42
43 //CHECK#6
44 if(!(f2() === 0)){
45 throw new Test262Error('#6: argument.length === 0');
46 }
47
48 //CHECK#7
49 if(!(f2(0) === 1)){
50 throw new Test262Error('#7: argument.length === 1');
51 }
52
53 //CHECK#8
54 if(!(f2(0, 1) === 2)){
55 throw new Test262Error('#8: argument.length === 2');
56 }
57
58 //CHECK#9
59 if(!(f2(0, 1, 2) === 3)){
60 throw new Test262Error('#9: argument.length === 3');
61 }
62
63 //CHECK#10
64 if(!(f2(0, 1, 2, 3) === 4)){
65 throw new Test262Error('#10: argument.length === 4');
66 }
67
68 reportCompare(0, 0);