diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement')
58 files changed, 3726 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A1.js new file mode 100644 index 000000000..be1377005 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A1.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A1; + * @section: 12.14; + * @assertion: The production TryStatement : try Block Catch is evaluated as follows: 2. If Result(1).type is not throw, return Result(1); + * @description: Executing TryStatement : try Block Catch. The statements doesn't cause actual exceptions; + */ + +// CHECK#1 +try { + var x=0; +} +catch (e) { + $ERROR('#1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))'); +} + +// CHECK#2 +var c1=0; +try{ + var x1=1; +} +finally +{ + c1=1; +} +if(x1!==1){ + $ERROR('#2.1: "try" block must be evaluated. Actual: try Block has not been evaluated'); +} +if (c1!==1){ + $ERROR('#2.2: "finally" block must be evaluated. Actual: finally Block has not been evaluated'); +} + +// CHECK#3 +var c2=0; +try{ + var x2=1; +} +catch(e){ + $ERROR('#3.1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))'); +} +finally{ + c2=1; +} +if(x2!==1){ + $ERROR('#3.2: "try" block must be evaluated. Actual: try Block has not been evaluated'); +} +if (c2!==1){ + $ERROR('#3.3: "finally" block must be evaluated. Actual: finally Block has not been evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T1.js new file mode 100644 index 000000000..bc083cae9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A10_T1; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Throwing exception while executing iteration statement placed into try Block; + */ + +// CHECK#1 +var i=0; +try{ +while(i<10){ + if(i===5) throw i; + i++; +} +} +catch(e){ + if(e!==5)$ERROR('#1: Exception === 5. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T2.js new file mode 100644 index 000000000..083cc9b4b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T2.js @@ -0,0 +1,115 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A10_T2; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Try statement inside loop, where use continue loop; + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +}; +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2: "finally" block must be evaluated at "try catch{continue} finally" construction'); +} + +// CHECK#3 +var c3=0,fin3=0; +while(c3<2){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(fin3!==1){ + $ERROR('#3: "finally" block must be evaluated at "try catch finally{continue}" construction'); +} + +// CHECK#4 +var c4=0,fin4=0; +while(c4<2){ + try{ + c4+=1; + continue; + } + finally{ + fin4=1; + } + fin4=-1; +}; +if(fin4!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +while(c5<2){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } +} +if(c5!==2){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +while(c6<2){ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==2){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T3.js new file mode 100644 index 000000000..7bf95fd30 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T3.js @@ -0,0 +1,150 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A10_T3; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Try statement inside loop, where use break; + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +while(c3<2){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +while(c4<2){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +while(c5<2){ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +} +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +while(c6<2){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + while(c7<2){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T4.js new file mode 100644 index 000000000..1f0e49e7e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T4.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A10_T4; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Try statement inside loop, where combinate using break and continue; + */ + +// CHECK#1 +var c1=0,fin=0; +while(c1<2){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==2){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +while(c2<2){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==2){ + $ERROR('#2.2: "try catch{break} finally{continue} must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T5.js new file mode 100644 index 000000000..a9f152725 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A10_T5.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A10_T5; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "while" statement; + * @description: Throw some exceptions from different place of loop body; + */ + +// CHECK#1 +var c=0, i=0; +var fin=0; +while(i<10){ + i+=1; + try{ + if(c===0){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + c+=2; + if(c===1){ + throw "ex2"; + $ERROR('#1.2: throw "ex2" lead to throwing exception'); + } + } + catch(er1){ + c-=1; + continue; + $ERROR('#1.3: "try catch{continue} finally" must work correctly'); + } + finally{ + fin+=1; + } +} +if(fin!==10){ + $ERROR('#1.4: "finally" block must be evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T1.js new file mode 100644 index 000000000..0722243c5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A11_T1; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for" statement; + * @description: Loop inside try Block, where throw exception; + */ + +// CHECK#1 +try{ + for(var i=0;i<10;i++){ + if(i===5) throw i; + } +} +catch(e){ + if(e!==5)$ERROR('#1: Exception === 5. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T2.js new file mode 100644 index 000000000..07847e5de --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T2.js @@ -0,0 +1,122 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A11_T2; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for" statement; + * @description: Try statement inside loop, where use continue loop; + */ + +// CHECK#1 +var fin=0; +for(var i=0;i<5;i++){ + try{ + i+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==5){ + $ERROR('#2.1: "try catch{continue} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==5){ + $ERROR('#3.2: "try catch finally{continue}" must work correctly'); +} + +// CHECK#4 +var fin=0; +for(var i=0;i<5;i++){ + try{ + i+=1; + continue; + } + finally{ + fin=1; + } + fin=-1; +}; +if(fin!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +for(var c5=0;c5<10;){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } + c5+=12; +}; +if(c5!==10){ + $ERROR('#5: "try catch{continue} must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +for(var c6=0;c6<10;){ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +}; +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==10){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T3.js new file mode 100644 index 000000000..dc4444c7c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T3.js @@ -0,0 +1,149 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A11_T3; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for" statement; + * @description: Try statement inside loop, where use break; + */ + +// CHECK#1 +var c1=0,fin=0; +for(var i=0;i<5;i++){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +}; +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +}; +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +}; +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +for(var i=0;i<5;i++){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +}; +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +}; +if(i!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +for(var c6=0;c6<5;){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +}; +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + for(var c7=0;c7<5;){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T4.js new file mode 100644 index 000000000..25934836f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A11_T4.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A11_T4; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for" statement; + * @description: Try statement inside loop, where combinate using break and continue; + */ + +// CHECK#1 +var c1=0,fin=0; +for(var i=0;i<5;i++){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==5){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for(var i=0;i<5;i++){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==5){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T1.js new file mode 100644 index 000000000..14c7cb41a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A12_T1; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for-in" statement; + * @description: Loop inside try Block, where throw exception; + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +try{ + for (x in mycars){ + if (mycars[x]==="BMW") throw "ex"; + } +} +catch(e){ + if(e!=="ex")$ERROR('#1: Exception ==="ex". Actual: Exception ==='+ e ); +} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T2.js new file mode 100644 index 000000000..9d97197fb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T2.js @@ -0,0 +1,131 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A12_T2; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for-in" statement; + * @description: Try statement inside loop, where use continue loop; + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var fin=0; +var i=0; +for (x in mycars){ + try{ + i+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(i!==3){ + $ERROR('#1.2: "try{continue} catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==3){ + $ERROR('#2.1: "try catch{continue} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +if(c3!==3){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(fin3!==1){ + $ERROR('#3.2: "try catch finally{continue}" must work correctly'); +} + +// CHECK#4 +var fin=0; +for (x in mycars){ + try{ + continue; + } + finally{ + fin=1; + } + fin=-1; +} +if(fin!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } + c5+=12; +} +if(c5!==3){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +for (x in mycars){ + try{ + c6+=1; + throw "ex1"; + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==3){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T3.js new file mode 100644 index 000000000..e4749adbe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T3.js @@ -0,0 +1,161 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A12_T3; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for-in" statement; + * @description: Try statement inside loop, where use break; + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var c1=0,fin=0; +for (x in mycars){ + try{ + c1+=1; + break; + } + catch(er1){ + c1+=1; + } + finally{ + fin=1; + } + fin=-1; + c1+=2; +}; +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +for (x in mycars){ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +for (x in mycars){ + try{ + throw "ex1"; + c5++; + } + catch(er1){ + break; + c5++; + } + c5++; +} +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +for (x in mycars){ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + for (x in mycars){ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: "try finally{break}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T4.js new file mode 100644 index 000000000..07c979fde --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A12_T4.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A12_T4; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "for-in" statement; + * @description: Try statement inside loop, where combinate using break and continue; + */ + +var x; +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +// CHECK#1 +var c1=0,fin=0; +for (x in mycars){ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==3){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +for (x in mycars){ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==3){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T1.js new file mode 100644 index 000000000..7535db7f0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A13_T1; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement with a "return" statement; + * @description: Using try/catch syntax construction; + */ + +// CHECK#1 +function myFunction1(){ + try{ + return 1; + } + catch(err){ + $ERROR('#1.1: "return 1" inside function does not lead to throwing exception'); + return 0; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.2: x1===1. Actual: x1==='+x1); +} + +// CHECK#2 +function myFunction2(){ + try{ + throw "exc"; + return 1; + }catch(err){ + return 2; + } + return 3; +} +var x2=myFunction2(); +if (x2!==2){ + $ERROR('#2: x2===2. Actual: x2==='+x2); +} + +// CHECK#3 +function myFunction3(){ + try{ + return someValue; + }catch(err){ + return 1; + } + return 2; +} +var x3=myFunction3(); +if (x3!==1){ + $ERROR('#3: x3===1. Actual: x3==='+x3); +} + +// CHECK#4 +function myFunction4(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2" + return 0; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#4.2: Exception !=="ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#4.3: Exception ==="ex2". Actual: Exception ==='+ e ); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T2.js new file mode 100644 index 000000000..53ae98fe2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T2.js @@ -0,0 +1,181 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A13_T2; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement with a "return" statement; + * @description: Using try/finally syntax construction; + */ + +// CHECK#1 +var c1=0; +function myFunction1(){ + try{ + return 1; + }finally{ + c1=1; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.1: x1===1. Actual: x1==='+x1); +} +if (c1!==1){ + $ERROR('#1.2: "finally" block must be evaluated'); +} + +// CHECK#2 +var c2=0; +function myFunction2(){ + try{ + throw "exc"; + return 1; + }finally{ + c2=1; + } + return 2; +} +try{ + var x2=myFunction2(); + $ERROR('#2.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c2!==1){ + $ERROR('#2.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0; +function myFunction3(){ + try{ + return someValue; + }finally{ + c3=1; + } + return 2; +} +try{ + var x3=myFunction3(); + $ERROR('#3.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c3!==1){ + $ERROR('#3.2: "finally" block must be evaluated'); + } +} + +// CHECK#4 +var c4=0; +function myFunction4(){ + try{ + return 1; + }finally{ + c4=1; + throw "exc"; + return 0; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.2: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c4!==1){ + $ERROR('#4.3: "finally" block must be evaluated'); + } +} + +// CHECK#5 +var c5=0; +function myFunction5(){ + try{ + return 1; + }finally{ + c5=1; + return someValue; + return 0; + } + return 2; +} +try{ + var x5=myFunction5(); + $ERROR('#5.2: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if (c5!==1){ + $ERROR('#5.3: "finally" block must be evaluated'); + } +} + +// CHECK#6 +var c6=0; +function myFunction6(){ + try{ + throw "ex1"; + return 1; + }finally{ + c6=1; + throw "ex2"; + return 2; + } + return 3; +} +try{ + var x6=myFunction6(); + $ERROR('#6.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#6.2: Exception !=="ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#6.3: Exception !=="ex1". Actual: '+e); + } + if (c6!==1){ + $ERROR('#6.4: "finally" block must be evaluated'); + } +} + +// CHECK#7 +var c7=0; +function myFunction7(){ + try{ + return 1; + }finally{ + c7=1; + return 2; + } + return 3; +} +var x7=myFunction7(); +if(x7!==2){ + $ERROR('#7.1: "catch" block must be evaluated'); +} +if (c7!==1){ + $ERROR('#7.2: "finally" block must be evaluated'); +} + +// CHECK#8 +var c8=0; +function myFunction8(){ + try{ + throw "ex1"; + }finally{ + c8=1; + return 2; + } + return 3; +} +try{ + var x8=myFunction8(); +} +catch(ex1){ + c8=10; +} +if (c8!==1){ + $ERROR('#8: "finally" block must be evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T3.js new file mode 100644 index 000000000..bc64ecf3b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A13_T3.js @@ -0,0 +1,185 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A13_T3; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement with a "return" statement; + * @description: Using try/catch/finally syntax construction; + */ + +// CHECK#1 +var c1=0; +function myFunction1(){ + try{ + return 1; + }catch(err){ + $ERROR('#1.1: "return 1" inside function does not lead to throwing exception'); + return 0; + }finally{ + c1=1; + } + return 2; +} +var x1=myFunction1(); +if(x1!==1){ + $ERROR('#1.3: x1===1. Actual: x1==='+x1); +} +if (c1!==1){ + $ERROR('#1.4: "finally" block must be evaluated'); +} + +// CHECK#2 +var c2=0; +function myFunction2(){ + try{ + throw "exc"; + return 1; + }catch(err){ + return 0; + }finally{ + c2=1; + } + return 2; +} +var x2=myFunction2(); +if (c2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if (x2!==0){ + $ERROR('#2.2: x2===0. Actual: x2==='+x2); +} + +// CHECK#3 +var c3=0; +function myFunction3(){ + try{ + return someValue; + }catch(err){ + return 1; + }finally{ + c3=1; + } + return 2; +} +var x3=myFunction3(); +if (c3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if (x3!==1){ + $ERROR('#3.2: x3===1. Actual: x3==='+x3); +} + +// CHECK#4 +var c4=0; +function myFunction4(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2" + return 0; + }finally{ + c4=1; + } + return 2; +} +try{ + var x4=myFunction4(); + $ERROR('#4.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#4.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#4.3: Exception === "ex2". Actual: Exception ==='+ e ); + } + if (c4!==1){ + $ERROR('#4.4: "finally" block must be evaluated'); + } +} + +// CHECK#5 +var c5=0; +function myFunction5(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + return 0; + }finally{ + c5=1; + throw "ex2"; + } + return 2; +} +try{ + var x5=myFunction5(); + $ERROR('#5.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#5.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e!=="ex2"){ + $ERROR('#5.3: Exception === "ex2". Actual: Exception ==='+ e ); + } + if (c5!==1){ + $ERROR('#5.4: "finally" block must be evaluated'); + } +} + +// CHECK#6 +var c6=0; +function myFunction6(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2"; + return 0; + }finally{ + c6=1; + throw "ex3"; + } + return 2; +} +try{ + var x6=myFunction6(); + $ERROR('#6.1: Throwing exception inside function lead to throwing exception outside this function'); +} +catch(e){ + if(e==="ex1"){ + $ERROR('#6.2: Exception !== "ex1". Actual: catch previous exception'); + } + if(e==="ex2"){ + $ERROR('#6.3: Exception !== "ex2". Actual: catch previous exception'); + } + if(e!=="ex3"){ + $ERROR('#6.4: Exception === "ex3". Actual: Exception ==='+ e ); + } + if(c6!==1) $ERROR('#6.5: "finally" block must be evaluated'); +} + +// CHECK#7 +var c7=0; +function myFunction7(){ + try{ + throw "ex1"; + return 1; + }catch(err){ + throw "ex2"; + return 0; + }finally{ + c7=1; + return 2; + } + return 3; +} +try{ + var x7=myFunction7(); + if(x7!==2) $ERROR('#7.1: x7===2. Actual: x7==='+x7); +} +catch(e){} +if(c7!==1) $ERROR('#7.2: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A14.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A14.js new file mode 100644 index 000000000..d6b9298d4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A14.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A14; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "with" statement; + * @description: Using try/catch/finally in With and With in try/catch/finally; + * @strict_mode_negative SyntaxError; + */ + +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';} +} + +// CHECK#1 +try{ + with(myObj){ + throw "ex"; + } +} +catch(e){ + if (e!=="ex") $ERROR('#1: Exception ==="ex". Actual: Exception ==='+ e ); +} + +// CHECK#2 +with(myObj){ + try{ + throw p1; + } + catch(e){ + if (e!=="a") $ERROR('#2.1: Exception ==="a". Actual: Exception ==='+ e ); + p1='pass'; + } +} +if(myObj.p1!=='pass') $ERROR('#2.2: "throw p1" lead to throwing exception'); + +// CHECK#3 +with(myObj){ + try{ + p1='fail'; + throw p2; + } + catch(e){ + if (e!=="b") $ERROR('#3.1: Exception ==="b". Actual: Exception ==='+ e ); + p1='pass'; + } + finally{ + p2='pass'; + } +} +if(myObj.p1!=='pass') $ERROR('#3.2: "throw p2" lead to throwing exception'); +if(myObj.p2!=='pass') $ERROR('#3.3: "finally" block must be evaluated'); + +// CHECK#4 +myObj.p1='fail'; +try{ + with(myObj){ + try{ + throw p3; + } + finally{ + p1='pass'; + } + } +} +catch(e){} +if(myObj.p1!=='pass') $ERROR('#4: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A15.js new file mode 100644 index 000000000..60087fb5e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A15.js @@ -0,0 +1,91 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A15; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement within/without a "switch" statement; + * @description: Insert try/catch/finally to switch statement; + */ + +// CHECK#1 +function SwitchTest1(value){ + var result = 0; + try{ + switch(value) { + case 1: + result += 4; + throw result; + break; + default: + result += 32; + break; + case 4: + result += 64; + throw "ex"; + } + return result; + } + catch(e){ + if ((value===1)&&(e!==4)) $ERROR('#1.1: Exception ===4. Actual: Exception ==='+ e ); + if ((value===4)&&(e!=="ex")) $ERROR('#1.2: Exception ==="ex". Actual: Exception ==='+ e ); + } + finally{ + return result; + } +} +if (SwitchTest1(1)!==4) $ERROR('#1.3: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) ); +if (SwitchTest1(4)!==64) $ERROR('#1.4: SwitchTest1(4)===64. Actual: SwitchTest1(4)==='+ SwitchTest1(4) ); + +// CHECK#2 +var c2=0; +function SwitchTest2(value){ + var result = 0; + switch(value) { + case 0: + try{ + result += 2; + break; + } + finally{ + c2=1; + } + case 1: + result += 4; + break; + default: + result += 32; + break; + } + return result; +} +if (SwitchTest2(1)!==4) $ERROR('#2.1: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) ); +if (c2===1) $ERROR('#2.2: Evaluate finally block'); +if (SwitchTest2(0)!==2) $ERROR('#2.3: SwitchTest1(0)===2. Actual: SwitchTest1(0)==='+ SwitchTest1(0) ); +if (c2!==1) $ERROR('#2.4: "finally" block must be evaluated'); + +// CHECK#3 +function SwitchTest3(value){ + var result = 0; + switch(value) { + case 0: + try{ + result += 2; + throw "ex"; + } + finally{ + break; + } + default: + result += 32; + break; + } + return result; +} +try{ + var x3=SwitchTest3(0); + if (x3!==2) $ERROR('#3.1: x3===2. Actual: x3==='+x3); +} +catch(e){ + $ERROR('#3.2: Catching exception inside function does not lead to throwing exception outside this function'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T1.js new file mode 100644 index 000000000..4fefdd726 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T1.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T1; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if pure "try" syntax construction passes; + * @negative + */ + +// CHECK#1 +try diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T10.js new file mode 100644 index 000000000..f9f7cd60a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T10.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T10; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch: "catch (Identifier ) Block"; + * @negative + */ + +// CHECK#1 +try{} +catch(){} +finally{} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T11.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T11.js new file mode 100644 index 000000000..32c33b382 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T11.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T11; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch and Finally are placed into the Block of "try" (whitle expected outside); + * @negative + */ + +// CHECK#1 +try{ + { + } + catch(e){} + finally{} +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T12.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T12.js new file mode 100644 index 000000000..61693d517 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T12.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T12; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Embedded "try" statements followed by two "catch" statements; + * @negative + */ + +// CHECK#1 +try +{ + try + { + } +} +catch(e1){} +catch(e2){} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T13.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T13.js new file mode 100644 index 000000000..ff38025e2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T13.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T13; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch: "catch (Identifier ) Block". Checking if execution of "22" passes at the place of Identifier of "catch"; + * @negative + */ + +// CHECK#1 +try +{ +} +catch("22") +{ +} + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T14.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T14.js new file mode 100644 index 000000000..31bb1d66e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T14.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T14; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if passing argument to "try" statement fails; + * @negative + */ + +// CHECK#1 +try(e1){ +} +catch(e){} + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T15.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T15.js new file mode 100644 index 000000000..0c5441749 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T15.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T15; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Finally: "finally Block". Checking if passing argument to "try" statement fails; + * @negative + */ + +// CHECK#1 +try{ +} +finally(e){} + + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T2.js new file mode 100644 index 000000000..1f9deb436 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T2.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T2; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if execution of "catch" with no "try" fails; + * @negative + */ + +// CHECK#1 +catch diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T3.js new file mode 100644 index 000000000..09db8002d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T3.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T3; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if execution of "finally" with no "try" fails; + * @negative + */ + +// CHECK#1 +finally diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T4.js new file mode 100644 index 000000000..7d0a3b089 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T4.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T4; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch: "catch (Identifier ) Block". Checking if execution of "catch" that takes no arguments fails; + * @negative + */ + +// CHECK#1 +try{} +catch{} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T5.js new file mode 100644 index 000000000..067dd0539 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T5.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T5; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Catch: "catch (Identifier ) Block". Checking if execution of "catch" with no Block fails; + * @negative + */ + +// CHECK#1 +try{} +catch() diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T6.js new file mode 100644 index 000000000..c29bd071a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T6.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T6; + * @section: 12.14, 12.1; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Block: "{ StatementList }". Checking if execution of "try{ catch{}{}" fails; + * @negative + */ + +// CHECK#1 +try{ +catch(){} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T7.js new file mode 100644 index 000000000..b18356355 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T7.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T7; + * @section: 12.14, 12.1; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Block: "{ StatementList }". Checking if execution of "try{} catch(){" fails; + * @negative + */ + +// CHECK#1 +try{} +catch(){ + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T8.js new file mode 100644 index 000000000..53af6e95b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T8.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T8; + * @section: 12.14, 12.1; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Block: "{ StatementList }". Catch: "catch (Identifier ) Block". Checking if execution of "try{} catch(){finally{}" fails; + * @negative + */ + +// CHECK#1 +try{} +catch(){ +finally{} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T9.js new file mode 100644 index 000000000..c2a031a37 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A16_T9.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A16_T9; + * @section: 12.14; + * @assertion: TryStatement: "try Block Catch" or "try Block Finally" or "try Block Catch Finally"; + * @description: Checking if execution of "catch(){} finally{}" fails; + * @negative + */ + +// CHECK#1 +catch(){} +finally{} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A17.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A17.js new file mode 100644 index 000000000..3b5ff12ff --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A17.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A17; + * @section: 12.14; + * @assertion: Using "try" with "catch" or "finally" statement in a constructor; + * @description: Creating exceptions within constructor; + */ + +var i=1; +function Integer( value, exception ) { + try{ + this.value = checkValue( value ); + if(exception) $ERROR('#'+i+'.1: Must be exception'); + } + catch(e){ + this.value = e.toString(); + if(!exception) $ERROR('#'+i+'.2: Don`t must be exception'); + } + i++; +} + +function checkValue(value){ + if(Math.floor(value)!=value||isNaN(value)){ + throw (INVALID_INTEGER_VALUE +": " + value); + } + else{ + return value; + } +} + +// CHECK#1 +new Integer(13, false); +// CHECK#2 +new Integer(NaN, true); +// CHECK#3 +new Integer(0, false); +// CHECK#4 +new Integer(Infinity, false); +// CHECK#5 +new Integer(-1.23, true); +// CHECK#6 +new Integer(Math.LN2, true); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T1.js new file mode 100644 index 000000000..d31249a05 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T1; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching undefined; + */ + +// CHECK#1 +try{ + throw undefined; +} +catch(e){ + if (e!==undefined) $ERROR('#1: Exception === undefined. Actual: '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T2.js new file mode 100644 index 000000000..985c79a52 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T2; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching null; + */ + +// CHECK#1 +try{ + throw null; +} +catch(e){ + if (e!==null) $ERROR('#1: Exception ===null. Actual: '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T3.js new file mode 100644 index 000000000..edd42501e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T3.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T3; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching boolean; + */ + +// CHECK#1 +try{ + throw true; +} +catch(e){ + if (e!==true) $ERROR('#1: Exception ===true. Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw false; +} +catch(e){ + if (e!==false) $ERROR('#2: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b=false; +try{ + throw b; +} +catch(e){ + if (e!==false) $ERROR('#3: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#4 +var b=true; +try{ + throw b; +} +catch(e){ + if (e!==true) $ERROR('#4: Exception ===true. Actual: Exception ==='+ e ); +} + +// CHECK#5 +var b=true; +try{ + throw b&&false; +} +catch(e){ + if (e!==false) $ERROR('#5: Exception ===false. Actual: Exception ==='+ e ); +} + +// CHECK#5 +var b=true; +try{ + throw b||false; +} +catch(e){ + if (e!==true) $ERROR('#6: Exception ===true. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T4.js new file mode 100644 index 000000000..d3f76e83b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T4.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T4; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching string; + */ + +// CHECK#1 +try{ + throw "exception #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#1: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw "exception"+" #1"; +} +catch(e){ + if (e!=="exception #1") $ERROR('#2: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b="exception #1"; +try{ + throw b; +} +catch(e){ + if (e!=="exception #1") $ERROR('#3: Exception ==="exception #1". Actual: Exception ==='+ e ); +} + +// CHECK#4 +var a="exception"; +var b=" #1"; +try{ + throw a+b; +} +catch(e){ + if (e!=="exception #1") $ERROR('#4: Exception ==="exception #1". Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T5.js new file mode 100644 index 000000000..699c88ce3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T5.js @@ -0,0 +1,101 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T5; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching Number; + */ + +// CHECK#1 +try{ + throw 13; +} +catch(e){ + if (e!==13) $ERROR('#1: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#2 +try{ + throw 10+3; +} +catch(e){ + if (e!==13) $ERROR('#2: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#3 +var b=13; +try{ + throw b; +} +catch(e){ + if (e!==13) $ERROR('#3: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#4 +var a=3; +var b=10; +try{ + throw a+b; +} +catch(e){ + if (e!==13) $ERROR('#4: Exception ===13. Actual: Exception ==='+ e ); +} + +// CHECK#5 +try{ + throw 2.13; +} +catch(e){ + if (e!==2.13) $ERROR('#5: Exception ===2.13. Actual: Exception ==='+ e ); +} + +// CHECK#6 +var ex=2/3; +try{ + throw 2/3; +} +catch(e){ + if (e!==ex) $ERROR('#6: Exception ===2/3. Actual: Exception ==='+ e ); +} + +// CHECK#7 +try{ + throw NaN; +} +catch(e){ + if (!isNaN(e)) $ERROR('#7: Exception is NaN'); +} + +// CHECK#8 +try{ + throw +Infinity; +} +catch(e){ + if (e!==+Infinity) $ERROR('#8: Exception ===+Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#9 +try{ + throw -Infinity; +} +catch(e){ + if (e!==-Infinity) $ERROR('#9: Exception ===-Infinity. Actual: Exception ==='+ e ); +} + +// CHECK#10 +try{ + throw +0; +} +catch(e){ + if (e!==+0) $ERROR('#10: Exception ===+0. Actual: Exception ==='+ e ); +} + +// CHECK#11 +try{ + throw -0; +} +catch(e){ + if (e!==-0) $ERROR('#11: Exception ===-0. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T6.js new file mode 100644 index 000000000..3f21bdf42 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T6.js @@ -0,0 +1,53 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T6; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching Object; + */ +var myObj = {p1: 'a', + p2: 'b', + p3: 'c', + value: 'myObj_value', + valueOf : function(){return 'obj_valueOf';}, + parseInt : function(){return 'obj_parseInt';}, + NaN : 'obj_NaN', + Infinity : 'obj_Infinity', + eval : function(){return 'obj_eval';}, + parseFloat : function(){return 'obj_parseFloat';}, + isNaN : function(){return 'obj_isNaN';}, + isFinite : function(){return 'obj_isFinite';}, + i:7, +} + +try{ + throw myObj; +} +catch(e){ +// CHECK#1 + if (e.p1!=="a") $ERROR('#1: e.p1==="a". Actual: e.p1==='+ e.p1 ); +// CHECK#2 + if (e.value!=='myObj_value') $ERROR('#2: e.value===\'myObj_value\'. Actual: e.value==='+ e.value ); +// CHECK#3 + if (e.eval()!=='obj_eval') $ERROR('#3: e.eval()===\'obj_eval\'. Actual: e.eval()==='+ e.eval() ); +} + +// CHECK#4 +myObj.i=6; +try{ + throw myObj; +} +catch(e){} +if (myObj.i!==6) $ERROR('#4: Handling of catch must be correct'); + +// CHECK#5 +myObj.i=6; +try{ + throw myObj; +} +catch(e){ + e.i=10; +} +if (myObj.i!==10) $ERROR('#5: Handling of catch must be correct'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T7.js new file mode 100644 index 000000000..b66fbac9a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A18_T7.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A18_T7; + * @section: 12.14, 12.13; + * @assertion: Catching objects with try/catch/finally statement; + * @description: Catching Array; + */ + +var mycars = new Array(); +mycars[0] = "Saab"; +mycars[1] = "Volvo"; +mycars[2] = "BMW"; + +var mycars2 = new Array(); +mycars2[0] = "Mercedes"; +mycars2[1] = "Jeep"; +mycars2[2] = "Suzuki"; + +// CHECK#1 +try{ + throw mycars; +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#1.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#2 +try{ + throw mycars.concat(mycars2); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#2.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#2.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } +} + +// CHECK#3 +try{ + throw new Array("Mercedes","Jeep","Suzuki"); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars2[i]) $ERROR('#3.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i]); + } +} + +// CHECK#4 +try{ + throw mycars.concat(new Array("Mercedes","Jeep","Suzuki")); +} +catch(e){ + for (var i=0;i<3;i++){ + if (e[i]!==mycars[i]) $ERROR('#4.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] ); + } + for (var i=3;i<6;i++){ + if (e[i]!==mycars2[i-3]) $ERROR('#4.'+i+': Exception['+i+']===mycars2['+(i-3)+']. Actual: Exception['+i+']==='+ e[i]); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T1.js new file mode 100644 index 000000000..80a07116a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T1.js @@ -0,0 +1,67 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A19_T1; + * @section: 12.14, 15.11, 16; + * @assertion: Catching system exceptions of different types with try statement; + * @description: Testing try/catch syntax construction; + */ + +// CHECK#1 +try{ + throw (Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} + +// CHECK#2 +try{ + throw (new Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#2: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} + +// CHECK#3 +var c3=0; +try{ + throw EvalError(1); +} +catch(e){ + if (e.toString()!=="EvalError: 1") $ERROR('#3: Exception.toString()==="EvalError: 1". Actual: Exception is '+e); +} + +// CHECK#4 +try{ + throw RangeError(1); +} +catch(e){ + if (e.toString()!=="RangeError: 1") $ERROR('#4: Exception.toString()==="RangeError: 1". Actual: Exception is '+e); +} + +// CHECK#5 +try{ + throw ReferenceError(1); +} +catch(e){ + if (e.toString()!=="ReferenceError: 1") $ERROR('#5: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e); +} + +// CHECK#6 +var c6=0; +try{ + throw TypeError(1); +} +catch(e){ + if (e.toString()!=="TypeError: 1") $ERROR('#6: Exception.toString()==="TypeError: 1". Actual: Exception is '+e); +} + +// CHECK#7 +try{ + throw URIError("message", "fileName", "1"); +} +catch(e){ + if (e.toString()!=="URIError: message") $ERROR('#7: Exception.toString()==="URIError: message". Actual: Exception is '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T2.js new file mode 100644 index 000000000..c1ff03c8d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A19_T2.js @@ -0,0 +1,101 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A19_T2; + * @section: 12.14; + * @assertion: Catching system exceptions of different types with try statement; + * @description: Testing try/catch/finally syntax construction; + */ + +var fin=0; +// CHECK#1 +try{ + throw (Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#1.1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#1.2: "finally" block must be evaluated'); + +// CHECK#2 +fin=0; +try{ + throw (new Error("hello")); +} +catch(e){ + if (e.toString()!=="Error: hello") $ERROR('#2.1: Exception.toString()==="Error: hello". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#2.2: "finally" block must be evaluated'); + +// CHECK#3 +fin=0; +var c3=0; +try{ + throw EvalError(1); +} +catch(e){ + if (e.toString()!=="EvalError: 1") $ERROR('#3.1: Exception.toString()==="EvalError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#3.2: "finally" block must be evaluated'); + +// CHECK#4 +fin=0; +try{ + throw RangeError(1); +} +catch(e){ + if (e.toString()!=="RangeError: 1") $ERROR('#4.1: Exception.toString()==="RangeError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#4.2: "finally" block must be evaluated'); + +// CHECK#5 +fin=0; +try{ + throw ReferenceError(1); +} +catch(e){ + if (e.toString()!=="ReferenceError: 1") $ERROR('#5.1: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#5.2: "finally" block must be evaluated'); + +// CHECK#6 +fin=0; +try{ + throw TypeError(1); +} +catch(e){ + if (e.toString()!=="TypeError: 1") $ERROR('#6.1: Exception.toString()==="TypeError: 1". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +fin=0; +try{ + throw URIError("message", "fileName", "1"); +} +catch(e){ + if (e.toString()!=="URIError: message") $ERROR('#7.1: Exception.toString()==="URIError: message". Actual: Exception is '+e); +} +finally{ + fin=1; +} +if (fin!==1) $ERROR('#7.2: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A2.js new file mode 100644 index 000000000..83b637fe5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A2.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A2; + * @section: 12.14; + * @assertion: Throwing exception with "throw" and catching it with "try" statement; + * @description: Checking if execution of "catch" catches an exception thrown with "throw"; + */ + +// CHECK#1 +try { + throw "catchme"; + $ERROR('#1: throw "catchme" lead to throwing exception'); +} +catch(e){} + +// CHECK#2 +var c2=0; +try{ + try{ + throw "exc"; + $ERROR('#2.1: throw "exc" lead to throwing exception'); + }finally{ + c2=1; + } +} +catch(e){ + if (c2!==1){ + $ERROR('#2.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0; +try{ + throw "exc"; + $ERROR('#3.1: throw "exc" lead to throwing exception'); +} +catch(err){ + var x3=1; +} +finally{ + c3=1; +} +if (x3!==1){ + $ERROR('#3.2: "catch" block must be evaluated'); +} +if (c3!==1){ + $ERROR('#3.3: "finally" block must be evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A3.js new file mode 100644 index 000000000..0d69b28b6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A3.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A3; + * @section: 12.14; + * @assertion: Catching system exception with "try" statement; + * @description: Checking if execution of "catch" catches system exceptions; + */ + +// CHECK#1 +try{ + y; + $ERROR('#1: "y" lead to throwing exception'); +} +catch(e){} + +// CHECK#2 +var c2=0; +try{ + try{ + someValue; + $ERROR('#3.1: "someValues" lead to throwing exception'); + } + finally{ + c2=1; + } +} +catch(e){ + if (c2!==1){ + $ERROR('#3.2: "finally" block must be evaluated'); + } +} + +// CHECK#3 +var c3=0,x3=0; +try{ + x3=someValue; + $ERROR('#3.1: "x3=someValues" lead to throwing exception'); +} +catch(err){ + x3=1; +} +finally{ + c3=1; +} +if (x3!==1){ + $ERROR('#3.2: "catch" block must be evaluated'); +} +if (c3!==1){ + $ERROR('#3.3: "finally" block must be evaluated'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A4.js new file mode 100644 index 000000000..e76809232 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A4.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A4; + * @section: 12.14; + * @assertion: Sanity test for "catch(Indetifier) statement"; + * @description: Checking if deleting an exception fails; + * @strict_mode_negative SyntaxError; + */ + +// CHECK#1 +try { + throw "catchme"; + $ERROR('#1.1: throw "catchme" lead to throwing exception'); +} +catch (e) { + if (delete e){ + $ERROR('#1.2: Exception has DontDelete property'); + } + if (e!=="catchme") { + $ERROR('#1.3: Exception === "catchme". Actual: Exception ==='+ e ); + } +} + +// CHECK#2 +try { + throw "catchme"; + $ERROR('#2.1: throw "catchme" lead to throwing exception'); +} +catch(e){} +try{ + e; + $ERROR('#2.2: Deleting catching exception after ending "catch" block'); +} +catch(err){} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A5.js new file mode 100644 index 000000000..5be0e3786 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A5.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A5; + * @section: 12.14; + * @assertion: The production TryStatement: "try Block Finally" and the production TryStatement: "try Block Catch Finally"; + * @description: Checking "catch" catches the Identifier in appropriate way; + */ + +// CHECK#1 +try { + throw "catchme"; + throw "dontcatchme"; + $ERROR('#1.1: throw "catchme" lead to throwing exception'); +} +catch (e) { + if(e==="dontcatchme"){ + $ERROR('#1.2: Exception !== "dontcatchme"'); + } + if (e!=="catchme") { + $ERROR('#1.3: Exception === "catchme". Actual: Exception ==='+ e ); + } +} + +// CHECK#2 +function SwitchTest1(value){ + var result = 0; + try{ + switch(value) { + case 1: + result += 4; + throw result; + break; + case 4: + result += 64; + throw "ex"; + } + return result; + } + catch(e){ + if ((value===1)&&(e!==4)) $ERROR('#2.1: Exception === 4. Actual: '+e); + if ((value===4)&&(e!=="ex"))$ERROR('#2.2: Exception === "ex". Actual: '+e); + } + finally{ + return result; + } +} +if (SwitchTest1(1)!==4) $ERROR('#2.3: "finally" block must be evaluated'); +if (SwitchTest1(4)!==64)$ERROR('#2.4: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A6.js new file mode 100644 index 000000000..fbdb4287d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A6.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A6; + * @section: 12.14; + * @assertion: The production TryStatement: "try Block Catch Finally"; + * @description: Executing sequence of "try" statements, using counters with varying values within; + */ + +// CHECK#1 +var c1=0; +try { + c1+=1; + y; + $ERROR('#1.1: "y" lead to throwing exception'); +} +catch (e) { + c1*=2; +} +if (c1!==2){ + $ERROR('#1.2: Sequence evaluation of commands try/catch is 1. try, 2. catch'); +} + +// CHECK#2 +var c2=0; +try{ + c2+=1; +} +finally{ + c2*=2; +} +if (c2!==2){ + $ERROR('#2: Sequence evaluation of commands try/finally is 1. try, 2. finally'); +} + +// CHECK#3 +var c3=0; +try{ + c3=1; + z; +} +catch(err){ + c3*=2; +} +finally{ + c3+=1; +} +if (c3!==3){ + $ERROR('#3: Sequence evaluation of commands try/catch/finally(with exception) is 1. try, 2. catch, 3. finally'); +} + +// CHECK#4 +var c4=0; +try{ + c4=1; +} +catch(err){ + c4*=3; +} +finally{ + c4+=1; +} +if (c4!==2){ + $ERROR('#4: Sequence evaluation of commands try/catch/finally(without exception) is 1. try, 2. finally'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T1.js new file mode 100644 index 000000000..b6b2609a3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T1.js @@ -0,0 +1,137 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A7_T1; + * @section: 12.14; + * @assertion: Evaluating the nested productions TryStatement; + * @description: Checking if the production of nested TryStatement statements evaluates correct; + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + catch(er2){ + if (er2!=="ex2") + $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+ e ); + throw "ex1"; + } + } + catch(er1){ + if (er1!=="ex1") $ERROR('#1.2: Exception === "ex1". Actual: '+er1); + if (er1==="ex2") $ERROR('#1.3: Exception !== "ex2". Actual: catch previous embedded exception'); +} + +// CHECK#2 +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#2.1: Exception !== "ex1". Actual: catch previous catching exception'); + if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+ er1 ); + } + if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous catching exception'); +} + +// CHECK#3 +try{ + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); +} +finally{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous embedded exception'); + if (er1!=="ex2") $ERROR('#3.3: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } +} + +// CHECK#4 +var c4=0; +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#4.1: Exception !=="ex1". Actual: catch previous catching exception'); + if (er1!=="ex2") $ERROR('#4.2: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } + if (er1!=="ex1") $ERROR('#4.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: Catch previous embedded exception'); +} +finally{ + c4=1; +} +if (c4!==1) $ERROR('#4.5: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#5.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#5.2: Exception ==="ex1". Actual: Exception ==='+ er1 ); + if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.4: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#6.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); + } +} +finally{ + c6=1; +} +if (c6!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#7.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); + if (er1==="ex1") $ERROR('#7.2: Exception !=="ex1". Actual: catch previous embedded exception'); + c7++; + } + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#7.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); +} +if (c7!==2) $ERROR('#7.4: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T2.js new file mode 100644 index 000000000..aba1d046f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T2.js @@ -0,0 +1,151 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A7_T2; + * @section: 12.14; + * @assertion: Evaluating the nested productions TryStatement; + * @description: Checking if the production of nested TryStatement statements evaluates correct; + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + finally{ + throw "ex1"; + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#1.2: Exception === "ex1". Actual: Exception ==='+er1 ); + if (er1==="ex2") $ERROR('#1.3: Exception !== "ex2". Actual: catch previous embedded exception'); +} + +// CHECK#2 +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#2.1: Exception === "ex1". Actual: Exception ==='+er1 ); + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + $ERROR('#2.2: throw "ex1" lead to throwing exception'); + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#2.3: Exception === "ex3". Actual: Exception ==='+er1 ); +} + +// CHECK#3 +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception === "ex1". Actual: Exception ==='+er1 ); + } + finally{ + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#3.2: Exception === "ex3". Actual: Exception ==='+er1 ); +} + +// CHECK#4 +var c4=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#4.1: Exception === "ex1". Actual: Exception ==='+er1 ); + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + } + finally{ + c4=1; + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#4.2: Exception === "ex3". Actual: Exception ==='+er1 ); +} +if (c4!==1) $ERROR('#4.3: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + finally{ + throw "ex3"; + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex3") $ERROR('#5.1: Exception === "ex3". Actual: Exception ==='+er1 ); + if (er1==="ex2") $ERROR('#5.2: Exception !== "ex2". Actual: catch previous embedded exception'); + if (er1==="ex1") $ERROR('#5.3: Exception !=="ex1". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.4: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + try{ + throw "ex1"; + } + finally{ + throw "ex2"; + } + } + finally{ + c6=1; + } +} +catch(er1){ + if (er1!=="ex2") $ERROR('#6.1: Exception === "ex2". Actual: Exception ==='+er1 ); +} +if (c6!==1) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + finally{ + c7++; + throw "ex3"; + } + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#7.1: Exception === "ex3". Actual: Exception ==='+er1 ); +} +if (c7!==2) $ERROR('#7.2: Embedded "try/finally" blocks must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T3.js new file mode 100644 index 000000000..986cddd0e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A7_T3.js @@ -0,0 +1,168 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A7_T3; + * @section: 12.14; + * @assertion: Evaluating the nested productions TryStatement; + * @description: Checking if the production of nested TryStatement statements evaluates correct; + */ + +// CHECK#1 +try{ + try{ + throw "ex2"; + } + catch(er2){ + if (er2!=="ex2") $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+er2); + throw "ex1"; + } + finally{ + throw "ex3"; + } +} +catch(er1){ + if (er1!=="ex3") $ERROR('#1.2: Exception === "ex3". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#1.3: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex1") $ERROR('#1.4: Exception !=="ex1". Actual: catch previous embedded exception'); +} + +// CHECK#2 +var c2=0; +try{ + throw "ex1"; +} +catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#2.1: Exception !=="ex1". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c2=1; + } + if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous embedded exception'); +} +if (c2!==1) $ERROR('#2.5: "finally" block must be evaluated'); + +// CHECK#3 +var c3=0; +try{ + throw "ex1"; +} +catch(er1){ + if (er1!=="ex1") $ERROR('#3.1: Exception === "ex1". Actual: Exception ==='+er1); +} +finally{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#3.3: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c3=1; + } +} +if (c3!==1) $ERROR('#3.4: "finally" block must be evaluated'); + +// CHECK#4 +var c4=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + try{ + throw "ex2"; + } + catch(er1){ + if (er1==="ex1") $ERROR('#4.1: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1!=="ex2") $ERROR('#4.2: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + c4=2; + throw "ex3"; + } + if (er1!=="ex1") $ERROR('#4.3: Exception === "ex2". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex3") $ERROR('#4.5: Exception !=="ex3". Actual: Catch previous embedded exception'); + } + finally{ + c4*=2; + } +} +catch(er1){} +if (c4!==4) $ERROR('#4.6: "finally" block must be evaluated'); + +// CHECK#5 +var c5=0; +try{ + try{ + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#5.1: Exception === "ex2". Actual: Exception ==='+er1); + } + finally{ + throw "ex3"; + } + throw "ex1"; +} +catch(er1){ + if (er1!=="ex3") $ERROR('#5.2: Exception === "ex3". Actual: Exception ==='+er1); + if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous catched exception'); + if (er1==="ex1") $ERROR('#5.4: Exception !=="ex1". Actual: catch previous embedded exception'); +} +finally{ + c5=1; +} +if (c5!==1) $ERROR('#5.5: "finally" block must be evaluated'); + +// CHECK#6 +var c6=0; +try{ + try{ + throw "ex1"; + } + catch(er1){ + if (er1!=="ex1") $ERROR('#6.1: Exception === "ex1". Actual: Exception ==='+er1); + } + finally{ + c6=2; + } +} +finally{ + c6*=2; +} +if (c6!==4) $ERROR('#6.2: "finally" block must be evaluated'); + +// CHECK#7 +var c7=0; +try{ + try{ + throw "ex1"; + } + finally{ + try{ + c7=1; + throw "ex2"; + } + catch(er1){ + if (er1!=="ex2") $ERROR('#7.1: Exception === "ex2". Actual: Exception ==='+er1); + if (er1==="ex1") $ERROR('#7.2: Exception !=="ex2". Actual: catch previous catched exception'); + c7++; + } + finally{ + c7*=2; + } + } +} +catch(er1){ + if (er1!=="ex1") $ERROR('#7.3: Exception === "ex1". Actual: Exception ==='+er1); +} +if (c7!==4) $ERROR('#7.4: "finally" block must be evaluated'); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A8.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A8.js new file mode 100644 index 000000000..70773f9fa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A8; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "if" statement; + * @description: Throwing exception within an "if" statement; + */ + +// CHECK#1 +var c1=1; +try{ + if(c1===1){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + $ERROR('#1.2: throw "ex1" inside the "if" statement lead to throwing exception'); +} +catch(er1){ + if (er1!=="ex1") $ERROR('#1.3: Exception ==="ex1". Actual: Exception ==='+er1); +} + +// CHECK#2 +var c2=1; +if(c2===1){ + try{ + throw "ex1"; + $ERROR('#2.1: throw "ex1" lead to throwing exception'); + } + catch(er1){ + if(er1!="ex1") $ERROR('#2.2: Exception ==="ex1". Actual: Exception ==='+er1); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T1.js new file mode 100644 index 000000000..fdc80da99 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T1; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: Loop within a "try" Block, from where exception is thrown; + */ + +// CHECK#1 +var i=0; +try{ + do{ + if(i===5) throw i; + i++; + } + while(i<10); +} +catch(e){ + if(e!==5)$ERROR('#1: Exception ===5. Actual: Exception ==='+ e ); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T2.js new file mode 100644 index 000000000..343a24161 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T2.js @@ -0,0 +1,121 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T2; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: "try" statement within a loop, the statement contains "continue" statement; + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + continue; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1: "finally" block must be evaluated at "try{continue} catch finally" construction'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + continue; + } + finally{ + fin2=1; + } + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2: "finally" block must be evaluated at "try catch{continue} finally" construction'); +} + +// CHECK#3 +var c3=0,fin3=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + continue; + } + fin3=0; +} +while(c3<2); +if(fin3!==1){ + $ERROR('#3: "finally" block must be evaluated at "try catch finally{continue}" construction'); +} + +// CHECK#4 +var c4=0,fin4=0; +do{ + try{ + c4+=1; + continue; + } + finally{ + fin4=1; + } + fin4=-1; +} +while(c4<2); +if(fin4!==1){ + $ERROR('#4: "finally" block must be evaluated at "try{continue} finally" construction'); +} + +// CHECK#5 +var c5=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c5+=1; + continue; + } +} +while(c5<2); +if(c5!==2){ + $ERROR('#5: "try catch{continue}" must work correctly'); +} + +// CHECK#6 +var c6=0,fin6=0; +do{ + try{ + c6+=1; + throw "ex1" + } + finally{ + fin6=1; + continue; + } + fin6=-1; +} +while(c6<2); +if(fin6!==1){ + $ERROR('#6.1: "finally" block must be evaluated'); +} +if(c6!==2){ + $ERROR('#6.2: "try finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T3.js new file mode 100644 index 000000000..0fdf97307 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T3.js @@ -0,0 +1,157 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T3; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: "try" statement within a loop, the statement contains "break" statement; + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + } + fin=-1; + c1+=2; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==1){ + $ERROR('#1.2: "try{break}catch finally" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + } + c2+=2; + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==1){ + $ERROR('#2.2: "try catch{break} finally" must work correctly'); +} + +// CHECK#3 +var c3=0,fin3=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c3+=1; + } + finally{ + fin3=1; + break; + } + c3+=2; + fin3=0; +} +while(c3<2); +if(fin3!==1){ + $ERROR('#3.1: "finally" block must be evaluated'); +} +if(c3!==1){ + $ERROR('#3.2: "try catch finally{break}" must work correctly'); +} + +// CHECK#4 +var c4=0,fin4=0; +do{ + try{ + c4+=1; + break; + } + finally{ + fin4=1; + } + fin4=-1; + c4+=2; +} +while(c4<2); +if(fin4!==1){ + $ERROR('#4.1: "finally" block must be evaluated'); +} +if(c4!==1){ + $ERROR('#4.2: "try{break} finally" must work correctly'); +} + +// CHECK#5 +var c5=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + break; + } +} +while(c5<2); +if(c5!==0){ + $ERROR('#5: "try catch{break}" must work correctly'); +} + +// CHECK#6 +var c6=0; +do{ + try{ + c6+=1; + break; + } + catch(er1){} + c6+=2; +} +while(c6<2); +if(c6!==1){ + $ERROR('#6: "try{break} catch" must work correctly'); +} + +// CHECK#7 +var c7=0,fin7=0; +try{ + do{ + try{ + c7+=1; + throw "ex1"; + } + finally{ + fin7=1; + break; + } + fin7=-1; + c7+=2; + } + while(c7<2); +} +catch(ex1){ + c7=10; +} +if(fin7!==1){ + $ERROR('#7.1: "finally" block must be evaluated'); +} +if(c7!==1){ + $ERROR('#7.2: try finally{break} error'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T4.js new file mode 100644 index 000000000..72fbc4436 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T4.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T4; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: "try" statement within a loop, the statement contains "continue" and "break" statements; + */ + +// CHECK#1 +var c1=0,fin=0; +do{ + try{ + c1+=1; + break; + } + catch(er1){} + finally{ + fin=1; + continue; + } + fin=-1; + c1+=2; +} +while(c1<2); +if(fin!==1){ + $ERROR('#1.1: "finally" block must be evaluated'); +} +if(c1!==2){ + $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); +} + +// CHECK#2 +var c2=0,fin2=0; +do{ + try{ + throw "ex1"; + } + catch(er1){ + c2+=1; + break; + } + finally{ + fin2=1; + continue; + } + c2+=2; + fin2=-1; +} +while(c2<2); +if(fin2!==1){ + $ERROR('#2.1: "finally" block must be evaluated'); +} +if(c2!==2){ + $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T5.js new file mode 100644 index 000000000..1aaa65ad5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/12_Statement/12.14_The_try_Statement/S12.14_A9_T5.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S12.14_A9_T5; + * @section: 12.14; + * @assertion: "try" with "catch" or "finally" statement within/without an "do while" statement; + * @description: Checking if exceptions are thrown correctly from wherever of loop body; + */ + + +// CHECK#1 +var c=0, i=0; +var fin=0; +do{ + i+=1; + try{ + if(c===0){ + throw "ex1"; + $ERROR('#1.1: throw "ex1" lead to throwing exception'); + } + c+=2; + if(c===1){ + throw "ex2"; + $ERROR('#1.2: throw "ex2" lead to throwing exception'); + } + } + catch(er1){ + c-=1; + continue; + $ERROR('#1.3: "try catch{continue} finally" must work correctly'); + } + finally{ + fin+=1; + } +} +while(i<10); +if(fin!==10){ + $ERROR('#1.4: "finally" block must be evaluated'); +} + |