js/src/tests/test262/ch12/12.13/S12.13_A3_T6.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.13/S12.13_A3_T6.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     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 + * 1. Evaluate Expression
     1.9 + *
    1.10 + * @path ch12/12.13/S12.13_A3_T6.js
    1.11 + * @description Evaluating functions
    1.12 + */
    1.13 +
    1.14 +// CHECK#1
    1.15 +var i=0;
    1.16 +function adding1(){
    1.17 +  i++;
    1.18 +  return 1;
    1.19 +}
    1.20 +try{
    1.21 +  throw (adding1());
    1.22 +}
    1.23 +catch(e){
    1.24 +  if (e!==1) $ERROR('#1: Exception ===1. Actual:  Exception ==='+ e);
    1.25 +}
    1.26 +
    1.27 +// CHECK#2
    1.28 +var i=0;
    1.29 +function adding2(){
    1.30 +  i++;
    1.31 +  return i;
    1.32 +}
    1.33 +try{
    1.34 +  throw adding2();
    1.35 +}
    1.36 +catch(e){}
    1.37 +if (i!==1) $ERROR('#2: i===1. Actual: i==='+ i);
    1.38 +
    1.39 +// CHECK#3
    1.40 +var i=0;
    1.41 +function adding3(){
    1.42 +  i++;
    1.43 +}
    1.44 +try{
    1.45 +  throw adding3();
    1.46 +}
    1.47 +catch(e){}
    1.48 +if (i!==1) $ERROR('#3: i===1. Actual: i==='+i);
    1.49 +
    1.50 +// CHECK#4
    1.51 +function adding4(i){
    1.52 +  i++;
    1.53 +  return i;
    1.54 +}
    1.55 +try{
    1.56 +  throw (adding4(1));
    1.57 +}
    1.58 +catch(e){
    1.59 +  if (e!==2) $ERROR('#4: Exception ===2. Actual:  Exception ==='+ e);
    1.60 +}
    1.61 +

mercurial