js/src/tests/test262/ch12/12.13/S12.13_A2_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.13/S12.13_A2_T5.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     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 + * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression
     1.9 + *
    1.10 + * @path ch12/12.13/S12.13_A2_T5.js
    1.11 + * @description Throwing 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 +var b=13;
    1.24 +try{
    1.25 +  throw b;
    1.26 +}
    1.27 +catch(e){
    1.28 +  if (e!==13) $ERROR('#2: Exception ===13. Actual:  Exception ==='+ e );
    1.29 +}
    1.30 +
    1.31 +// CHECK#3
    1.32 +try{
    1.33 +  throw 2.13;
    1.34 +}
    1.35 +catch(e){
    1.36 +  if (e!==2.13) $ERROR('#3: Exception ===2.13. Actual:  Exception ==='+ e );
    1.37 +}
    1.38 +
    1.39 +// CHECK#4
    1.40 +try{
    1.41 +  throw NaN;
    1.42 +}
    1.43 +catch(e){
    1.44 +  if (!isNaN(e)) $ERROR('#4: Exception is NaN');
    1.45 +}
    1.46 +
    1.47 +// CHECK#5
    1.48 +try{
    1.49 +  throw +Infinity;
    1.50 +}
    1.51 +catch(e){
    1.52 +  if (e!==+Infinity) $ERROR('#5: Exception ===+Infinity. Actual:  Exception ==='+ e );
    1.53 +}
    1.54 +
    1.55 +// CHECK#6
    1.56 +try{
    1.57 +  throw -Infinity;
    1.58 +}
    1.59 +catch(e){
    1.60 +  if (e!==-Infinity) $ERROR('#6: Exception ===-Infinity. Actual:  Exception ==='+ e );
    1.61 +}
    1.62 +
    1.63 +// CHECK#7
    1.64 +try{
    1.65 +  throw +0;
    1.66 +}
    1.67 +catch(e){
    1.68 +  if (e!==+0) $ERROR('#7: Exception ===+0. Actual:  Exception ==='+ e );
    1.69 +}
    1.70 +
    1.71 +// CHECK#8
    1.72 +try{
    1.73 +  throw -0;
    1.74 +}
    1.75 +catch(e){
    1.76 +  if (e!==-0) $ERROR('#8: Exception ===-0. Actual:  Exception ==='+ e );
    1.77 +}
    1.78 +

mercurial