1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch12/12.14/S12.14_A1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 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 production TryStatement : try Block Catch is evaluated as follows: 2. If Result(1).type is not throw, return Result(1) 1.9 + * 1.10 + * @path ch12/12.14/S12.14_A1.js 1.11 + * @description Executing TryStatement : try Block Catch. The statements doesn't cause actual exceptions 1.12 + */ 1.13 + 1.14 +// CHECK#1 1.15 +try { 1.16 + var x=0; 1.17 +} 1.18 +catch (e) { 1.19 + $ERROR('#1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))'); 1.20 +} 1.21 + 1.22 +// CHECK#2 1.23 +var c1=0; 1.24 +try{ 1.25 + var x1=1; 1.26 +} 1.27 +finally 1.28 +{ 1.29 + c1=1; 1.30 +} 1.31 +if(x1!==1){ 1.32 + $ERROR('#2.1: "try" block must be evaluated. Actual: try Block has not been evaluated'); 1.33 +} 1.34 +if (c1!==1){ 1.35 + $ERROR('#2.2: "finally" block must be evaluated. Actual: finally Block has not been evaluated'); 1.36 +} 1.37 + 1.38 +// CHECK#3 1.39 +var c2=0; 1.40 +try{ 1.41 + var x2=1; 1.42 +} 1.43 +catch(e){ 1.44 + $ERROR('#3.1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))'); 1.45 +} 1.46 +finally{ 1.47 + c2=1; 1.48 +} 1.49 +if(x2!==1){ 1.50 + $ERROR('#3.2: "try" block must be evaluated. Actual: try Block has not been evaluated'); 1.51 +} 1.52 +if (c2!==1){ 1.53 + $ERROR('#3.3: "finally" block must be evaluated. Actual: finally Block has not been evaluated'); 1.54 +} 1.55 +