js/src/jit-test/tests/arguments/inline-rest-array-creation.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/arguments/inline-rest-array-creation.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,83 @@
     1.4 +function zero(...rest)
     1.5 +{
     1.6 +  assertEq(rest.length, 0, "zero rest wrong length");
     1.7 +}
     1.8 +
     1.9 +function tzero()
    1.10 +{
    1.11 +  zero();
    1.12 +}
    1.13 +
    1.14 +tzero(); tzero(); tzero();
    1.15 +
    1.16 +function one(...rest)
    1.17 +{
    1.18 +  assertEq(rest.length, 1, "one rest wrong length");
    1.19 +}
    1.20 +
    1.21 +function tone()
    1.22 +{
    1.23 +  one(0);
    1.24 +}
    1.25 +
    1.26 +tone(); tone(); tone();
    1.27 +
    1.28 +function two(...rest)
    1.29 +{
    1.30 +  assertEq(rest.length, 2, "two rest wrong length");
    1.31 +}
    1.32 +
    1.33 +function ttwo()
    1.34 +{
    1.35 +  two(0, 1);
    1.36 +}
    1.37 +
    1.38 +ttwo(); ttwo(); ttwo();
    1.39 +
    1.40 +function zeroWithLeading0(x, ...rest)
    1.41 +{
    1.42 +  assertEq(rest.length, 0, "zeroWithLeading0 rest wrong length");
    1.43 +}
    1.44 +
    1.45 +function tzeroWithLeading0()
    1.46 +{
    1.47 +  zeroWithLeading0();
    1.48 +}
    1.49 +
    1.50 +tzeroWithLeading0(); tzeroWithLeading0(); tzeroWithLeading0();
    1.51 +
    1.52 +function zeroWithLeading1(x, ...rest)
    1.53 +{
    1.54 +  assertEq(rest.length, 0, "zeroWithLeading1 rest wrong length");
    1.55 +}
    1.56 +
    1.57 +function tzeroWithLeading1()
    1.58 +{
    1.59 +  zeroWithLeading1(0);
    1.60 +}
    1.61 +
    1.62 +tzeroWithLeading1(); tzeroWithLeading1(); tzeroWithLeading1();
    1.63 +
    1.64 +function oneWithLeading(x, ...rest)
    1.65 +{
    1.66 +  assertEq(rest.length, 1, "oneWithLeading rest wrong length");
    1.67 +}
    1.68 +
    1.69 +function toneWithLeading()
    1.70 +{
    1.71 +  oneWithLeading(0, 1);
    1.72 +}
    1.73 +
    1.74 +toneWithLeading(); toneWithLeading(); toneWithLeading();
    1.75 +
    1.76 +function twoWithLeading(x, ...rest)
    1.77 +{
    1.78 +  assertEq(rest.length, 2, "twoWithLeading rest wrong length");
    1.79 +}
    1.80 +
    1.81 +function ttwoWithLeading()
    1.82 +{
    1.83 +  twoWithLeading(0, 1, 2);
    1.84 +}
    1.85 +
    1.86 +ttwoWithLeading(); ttwoWithLeading(); ttwoWithLeading();

mercurial