js/src/tests/test262/ch12/12.14/S12.14_A18_T5.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/test262/ch12/12.14/S12.14_A18_T5.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,102 @@
     1.4 +// Copyright 2009 the Sputnik authors.  All rights reserved.
     1.5 +// This code is governed by the BSD license found in the LICENSE file.
     1.6 +
     1.7 +/**
     1.8 + * Catching objects with try/catch/finally statement
     1.9 + *
    1.10 + * @path ch12/12.14/S12.14_A18_T5.js
    1.11 + * @description Catching Number
    1.12 + */
    1.13 +
    1.14 +// CHECK#1
    1.15 +try{
    1.16 +  throw 13;
    1.17 +}
    1.18 +catch(e){
    1.19 +  if (e!==13) $ERROR('#1: Exception ===13. Actual:  Exception ==='+ e  );
    1.20 +}
    1.21 +
    1.22 +// CHECK#2
    1.23 +try{
    1.24 +  throw 10+3;
    1.25 +}
    1.26 +catch(e){
    1.27 +  if (e!==13) $ERROR('#2: Exception ===13. Actual:  Exception ==='+ e  );
    1.28 +}
    1.29 +
    1.30 +// CHECK#3
    1.31 +var b=13;
    1.32 +try{
    1.33 +  throw b;
    1.34 +}
    1.35 +catch(e){
    1.36 +  if (e!==13) $ERROR('#3: Exception ===13. Actual:  Exception ==='+ e  );
    1.37 +}
    1.38 +
    1.39 +// CHECK#4
    1.40 +var a=3;
    1.41 +var b=10;
    1.42 +try{
    1.43 +  throw a+b;
    1.44 +}
    1.45 +catch(e){
    1.46 +  if (e!==13) $ERROR('#4: Exception ===13. Actual:  Exception ==='+ e  );
    1.47 +}
    1.48 +
    1.49 +// CHECK#5
    1.50 +try{
    1.51 +  throw 2.13;
    1.52 +}
    1.53 +catch(e){
    1.54 +  if (e!==2.13) $ERROR('#5: Exception ===2.13. Actual:  Exception ==='+ e  );
    1.55 +}
    1.56 +
    1.57 +// CHECK#6
    1.58 +var ex=2/3;
    1.59 +try{
    1.60 +  throw 2/3;
    1.61 +}
    1.62 +catch(e){
    1.63 +  if (e!==ex) $ERROR('#6: Exception ===2/3. Actual:  Exception ==='+ e  );
    1.64 +}
    1.65 +
    1.66 +// CHECK#7
    1.67 +try{
    1.68 +  throw NaN;
    1.69 +}
    1.70 +catch(e){
    1.71 +  if (!isNaN(e)) $ERROR('#7: Exception is NaN');
    1.72 +}
    1.73 +
    1.74 +// CHECK#8
    1.75 +try{
    1.76 +  throw +Infinity;
    1.77 +}
    1.78 +catch(e){
    1.79 +  if (e!==+Infinity) $ERROR('#8: Exception ===+Infinity. Actual:  Exception ==='+ e  );
    1.80 +}
    1.81 +
    1.82 +// CHECK#9
    1.83 +try{
    1.84 +  throw -Infinity;
    1.85 +}
    1.86 +catch(e){
    1.87 +  if (e!==-Infinity) $ERROR('#9: Exception ===-Infinity. Actual:  Exception ==='+ e  );
    1.88 +}
    1.89 +
    1.90 +// CHECK#10
    1.91 +try{
    1.92 +  throw +0;
    1.93 +}
    1.94 +catch(e){
    1.95 +  if (e!==+0) $ERROR('#10: Exception ===+0. Actual:  Exception ==='+ e  );
    1.96 +}
    1.97 +
    1.98 +// CHECK#11
    1.99 +try{
   1.100 +  throw -0;
   1.101 +}
   1.102 +catch(e){
   1.103 +  if (e!==-0) $ERROR('#11: Exception ===-0. Actual:  Exception ==='+ e  );
   1.104 +}
   1.105 +

mercurial