| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
var gTestfile = 'catchguard-001-n.js'; |
| 8 |
|
| 9 |
DESCRIPTION = " the non-guarded catch should HAVE to appear last"; |
| 10 |
EXPECTED = "error"; |
| 11 |
|
| 12 |
test(); |
| 13 |
|
| 14 |
function test() |
| 15 |
{ |
| 16 |
enterFunc ("test"); |
| 17 |
|
| 18 |
var EXCEPTION_DATA = "String exception"; |
| 19 |
var e; |
| 20 |
|
| 21 |
printStatus ("Catchguard syntax negative test."); |
| 22 |
|
| 23 |
try |
| 24 |
{ |
| 25 |
throw EXCEPTION_DATA; |
| 26 |
} |
| 27 |
catch (e) |
| 28 |
{ |
| 29 |
|
| 30 |
} |
| 31 |
catch (e if true) |
| 32 |
{ |
| 33 |
|
| 34 |
} |
| 35 |
catch (e if false) |
| 36 |
{ |
| 37 |
|
| 38 |
} |
| 39 |
|
| 40 |
reportCompare('PASS', 'FAIL', |
| 41 |
"Illegally constructed catchguard should have thrown " + |
| 42 |
"an exception."); |
| 43 |
|
| 44 |
exitFunc ("test"); |
| 45 |
} |