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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Copyright 2009 the Sputnik authors.  All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * Catching objects with try/catch/finally statement
     6  *
     7  * @path ch12/12.14/S12.14_A18_T5.js
     8  * @description Catching Number
     9  */
    11 // CHECK#1
    12 try{
    13   throw 13;
    14 }
    15 catch(e){
    16   if (e!==13) $ERROR('#1: Exception ===13. Actual:  Exception ==='+ e  );
    17 }
    19 // CHECK#2
    20 try{
    21   throw 10+3;
    22 }
    23 catch(e){
    24   if (e!==13) $ERROR('#2: Exception ===13. Actual:  Exception ==='+ e  );
    25 }
    27 // CHECK#3
    28 var b=13;
    29 try{
    30   throw b;
    31 }
    32 catch(e){
    33   if (e!==13) $ERROR('#3: Exception ===13. Actual:  Exception ==='+ e  );
    34 }
    36 // CHECK#4
    37 var a=3;
    38 var b=10;
    39 try{
    40   throw a+b;
    41 }
    42 catch(e){
    43   if (e!==13) $ERROR('#4: Exception ===13. Actual:  Exception ==='+ e  );
    44 }
    46 // CHECK#5
    47 try{
    48   throw 2.13;
    49 }
    50 catch(e){
    51   if (e!==2.13) $ERROR('#5: Exception ===2.13. Actual:  Exception ==='+ e  );
    52 }
    54 // CHECK#6
    55 var ex=2/3;
    56 try{
    57   throw 2/3;
    58 }
    59 catch(e){
    60   if (e!==ex) $ERROR('#6: Exception ===2/3. Actual:  Exception ==='+ e  );
    61 }
    63 // CHECK#7
    64 try{
    65   throw NaN;
    66 }
    67 catch(e){
    68   if (!isNaN(e)) $ERROR('#7: Exception is NaN');
    69 }
    71 // CHECK#8
    72 try{
    73   throw +Infinity;
    74 }
    75 catch(e){
    76   if (e!==+Infinity) $ERROR('#8: Exception ===+Infinity. Actual:  Exception ==='+ e  );
    77 }
    79 // CHECK#9
    80 try{
    81   throw -Infinity;
    82 }
    83 catch(e){
    84   if (e!==-Infinity) $ERROR('#9: Exception ===-Infinity. Actual:  Exception ==='+ e  );
    85 }
    87 // CHECK#10
    88 try{
    89   throw +0;
    90 }
    91 catch(e){
    92   if (e!==+0) $ERROR('#10: Exception ===+0. Actual:  Exception ==='+ e  );
    93 }
    95 // CHECK#11
    96 try{
    97   throw -0;
    98 }
    99 catch(e){
   100   if (e!==-0) $ERROR('#11: Exception ===-0. Actual:  Exception ==='+ e  );
   101 }

mercurial