catchguard-002-n.js (638B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- 2 * This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 7 DESCRIPTION = "var in catch clause should have caused an error."; 8 9 var expect; 10 var actual; 11 12 test(); 13 14 function test() 15 { 16 var EXCEPTION_DATA = "String exception"; 17 var e; 18 19 printStatus ("Catchguard var declaration negative test."); 20 21 try 22 { 23 throw EXCEPTION_DATA; 24 } 25 catch (var e) 26 { 27 actual = e + ''; 28 } 29 30 reportCompare(expect, actual, DESCRIPTION); 31 }