js/src/tests/test262/ch12/12.9/S12.9_A5.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/test262/ch12/12.9/S12.9_A5.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     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 + * Code after ReturnStatement is not evaluated
     1.9 + *
    1.10 + * @path ch12/12.9/S12.9_A5.js
    1.11 + * @description Using code after Return statement
    1.12 + */
    1.13 +
    1.14 +//CHECK#1
    1.15 +var x1=1;
    1.16 +function myfunc1(){
    1.17 +	x1++;
    1.18 +	return;
    1.19 +	x1*=2;
    1.20 +}
    1.21 +myfunc1();
    1.22 +if (x1!==2) $ERROR('#1: x1 === 2. Actual:  x1 ==='+ x1  );
    1.23 +
    1.24 +//CHECK#2
    1.25 +var x2=1;
    1.26 +function myfunc2(){
    1.27 +  x2++;
    1.28 +  return x2;
    1.29 +  x2*=2;
    1.30 +}
    1.31 +myfunc2();
    1.32 +if (x2!==2) $ERROR('#2: x2 === 2. Actual:  x2 ==='+ x2  );
    1.33 +
    1.34 +//CHECK#3
    1.35 +var x3=1;
    1.36 +function myfunc3(){
    1.37 +  x3++;
    1.38 +  return;
    1.39 +  return x3;
    1.40 +  x3*=2;
    1.41 +}
    1.42 +if (myfunc3()!==undefined) $ERROR('#3: myfunc3() === undefined. Actual:  myfunc3() ==='+ myfunc3()  );
    1.43 +

mercurial