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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/test262/ch10/10.6/S10.6_A6.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +// Copyright 2009 the Sputnik authors.  All rights reserved.
     1.5 +// This code is governed by the BSD license found in the LICENSE file.
     1.6 +
     1.7 +/**
     1.8 + * The initial value of the created property length is the number
     1.9 + * of actual parameter values supplied by the caller
    1.10 + *
    1.11 + * @path ch10/10.6/S10.6_A6.js
    1.12 + * @description Create function, that returned arguments.length
    1.13 + */
    1.14 +
    1.15 +function f1(){
    1.16 +  return arguments.length;
    1.17 +}
    1.18 +
    1.19 +//CHECK#1
    1.20 +if(!(f1() === 0)){
    1.21 +  $ERROR('#1: argument.length === 0');
    1.22 +}
    1.23 +
    1.24 +//CHECK#2
    1.25 +if(!(f1(0) === 1)){
    1.26 +  $ERROR('#2: argument.length === 1');
    1.27 +}
    1.28 +
    1.29 +//CHECK#3
    1.30 +if(!(f1(0, 1) === 2)){
    1.31 +  $ERROR('#3: argument.length === 2');
    1.32 +}
    1.33 +
    1.34 +//CHECK#4
    1.35 +if(!(f1(0, 1, 2) === 3)){
    1.36 +  $ERROR('#4: argument.length === 3');
    1.37 +}
    1.38 +
    1.39 +//CHECK#5
    1.40 +if(!(f1(0, 1, 2, 3) === 4)){
    1.41 +  $ERROR('#5: argument.length === 4');
    1.42 +}
    1.43 +
    1.44 +var f2 = function(){return arguments.length;};
    1.45 +
    1.46 +//CHECK#6
    1.47 +if(!(f2() === 0)){
    1.48 +  $ERROR('#6: argument.length === 0');
    1.49 +}
    1.50 +
    1.51 +//CHECK#7
    1.52 +if(!(f2(0) === 1)){
    1.53 +  $ERROR('#7: argument.length === 1');
    1.54 +}
    1.55 +
    1.56 +//CHECK#8
    1.57 +if(!(f2(0, 1) === 2)){
    1.58 +  $ERROR('#8: argument.length === 2');
    1.59 +}
    1.60 +
    1.61 +//CHECK#9
    1.62 +if(!(f2(0, 1, 2) === 3)){
    1.63 +  $ERROR('#9: argument.length === 3');
    1.64 +}
    1.65 +
    1.66 +//CHECK#10
    1.67 +if(!(f2(0, 1, 2, 3) === 4)){
    1.68 +  $ERROR('#10: argument.length === 4');
    1.69 +}
    1.70 +

mercurial