S12.13_A2_T5.js (1327B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 7 evaluates Expression 8 es5id: 12.13_A2_T5 9 description: Throwing number 10 ---*/ 11 12 // CHECK#1 13 try{ 14 throw 13; 15 } 16 catch(e){ 17 if (e!==13) throw new Test262Error('#1: Exception ===13. Actual: Exception ==='+ e ); 18 } 19 20 // CHECK#2 21 var b=13; 22 try{ 23 throw b; 24 } 25 catch(e){ 26 if (e!==13) throw new Test262Error('#2: Exception ===13. Actual: Exception ==='+ e ); 27 } 28 29 // CHECK#3 30 try{ 31 throw 2.13; 32 } 33 catch(e){ 34 if (e!==2.13) throw new Test262Error('#3: Exception ===2.13. Actual: Exception ==='+ e ); 35 } 36 37 // CHECK#4 38 try{ 39 throw NaN; 40 } 41 catch(e){ 42 assert.sameValue(e, NaN, "e is NaN"); 43 } 44 45 // CHECK#5 46 try{ 47 throw +Infinity; 48 } 49 catch(e){ 50 if (e!==+Infinity) throw new Test262Error('#5: Exception ===+Infinity. Actual: Exception ==='+ e ); 51 } 52 53 // CHECK#6 54 try{ 55 throw -Infinity; 56 } 57 catch(e){ 58 if (e!==-Infinity) throw new Test262Error('#6: Exception ===-Infinity. Actual: Exception ==='+ e ); 59 } 60 61 // CHECK#7 62 try{ 63 throw +0; 64 } 65 catch(e){ 66 if (e!==+0) throw new Test262Error('#7: Exception ===+0. Actual: Exception ==='+ e ); 67 } 68 69 // CHECK#8 70 try{ 71 throw -0; 72 } 73 catch(e){ 74 assert.sameValue(e, -0); 75 } 76 77 reportCompare(0, 0);