js/src/tests/test262/ch10/10.6/S10.6_A6.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:7bdabaae20ce
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 * The initial value of the created property length is the number
6 * of actual parameter values supplied by the caller
7 *
8 * @path ch10/10.6/S10.6_A6.js
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 $ERROR('#1: argument.length === 0');
19 }
20
21 //CHECK#2
22 if(!(f1(0) === 1)){
23 $ERROR('#2: argument.length === 1');
24 }
25
26 //CHECK#3
27 if(!(f1(0, 1) === 2)){
28 $ERROR('#3: argument.length === 2');
29 }
30
31 //CHECK#4
32 if(!(f1(0, 1, 2) === 3)){
33 $ERROR('#4: argument.length === 3');
34 }
35
36 //CHECK#5
37 if(!(f1(0, 1, 2, 3) === 4)){
38 $ERROR('#5: argument.length === 4');
39 }
40
41 var f2 = function(){return arguments.length;};
42
43 //CHECK#6
44 if(!(f2() === 0)){
45 $ERROR('#6: argument.length === 0');
46 }
47
48 //CHECK#7
49 if(!(f2(0) === 1)){
50 $ERROR('#7: argument.length === 1');
51 }
52
53 //CHECK#8
54 if(!(f2(0, 1) === 2)){
55 $ERROR('#8: argument.length === 2');
56 }
57
58 //CHECK#9
59 if(!(f2(0, 1, 2) === 3)){
60 $ERROR('#9: argument.length === 3');
61 }
62
63 //CHECK#10
64 if(!(f2(0, 1, 2, 3) === 4)){
65 $ERROR('#10: argument.length === 4');
66 }
67

mercurial