js/src/tests/test262/ch10/10.2/10.2.1/S10.2.1_A2.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.2/10.2.1/S10.2.1_A2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     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 + * If two or more formal parameters share the same name, hence
     1.9 + * the same property, the corresponding property is given the value that was
    1.10 + * supplied for the last parameter with this name
    1.11 + *
    1.12 + * @path ch10/10.2/10.2.1/S10.2.1_A2.js
    1.13 + * @description Creating functions initialized with two or more formal parameters, which have the same name
    1.14 + * @noStrict
    1.15 + */
    1.16 +
    1.17 +//CHECK#1
    1.18 +function f1(x, x) {
    1.19 +  return x;
    1.20 +}
    1.21 +if(!(f1(1, 2) === 2)) {
    1.22 +  $ERROR("#1: f1(1, 2) === 2");
    1.23 +}
    1.24 +
    1.25 +//CHECK#2
    1.26 +function f2(x, x, x){
    1.27 +  return x*x*x;
    1.28 +}
    1.29 +if(!(f2(1, 2, 3) === 27)){
    1.30 +  $ERROR("f2(1, 2, 3) === 27");
    1.31 +}
    1.32 +
    1.33 +//CHECK#3
    1.34 +function f3(x, x) {
    1.35 +  return 'a' + x;
    1.36 +}
    1.37 +if(!(f3(1, 2) === 'a2')){
    1.38 +  $ERROR("#3: f3(1, 2) === 'a2'");
    1.39 +}
    1.40 +

mercurial