| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-346494.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 346494; |
| 9 |
var summary = 'try-catch-finally scope'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
test(); |
| 16 |
|
| 17 |
|
| 18 |
function test() |
| 19 |
{ |
| 20 |
enterFunc ('test'); |
| 21 |
printBugNumber(BUGNUMBER); |
| 22 |
printStatus (summary); |
| 23 |
|
| 24 |
function g() |
| 25 |
{ |
| 26 |
try |
| 27 |
{ |
| 28 |
throw "foo"; |
| 29 |
} |
| 30 |
catch(e if e == "bar") |
| 31 |
{ |
| 32 |
} |
| 33 |
catch(e if e == "baz") |
| 34 |
{ |
| 35 |
} |
| 36 |
finally |
| 37 |
{ |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
expect = "foo"; |
| 42 |
try |
| 43 |
{ |
| 44 |
g(); |
| 45 |
actual = 'No Exception'; |
| 46 |
} |
| 47 |
catch(ex) |
| 48 |
{ |
| 49 |
actual = ex + ''; |
| 50 |
} |
| 51 |
reportCompare(expect, actual, summary); |
| 52 |
|
| 53 |
expect = |
| 54 |
'function g() {\n' + |
| 55 |
' try {\n' + |
| 56 |
' throw "foo";\n' + |
| 57 |
' } catch (e if e == "bar") {\n' + |
| 58 |
' } catch (e if e == "baz") {\n' + |
| 59 |
' } finally {\n' + |
| 60 |
' }\n' + |
| 61 |
'}'; |
| 62 |
|
| 63 |
actual = g + ''; |
| 64 |
reportCompare(expect, actual, summary); |
| 65 |
|
| 66 |
function h() |
| 67 |
{ |
| 68 |
try |
| 69 |
{ |
| 70 |
throw "foo"; |
| 71 |
} |
| 72 |
catch(e if e == "bar") |
| 73 |
{ |
| 74 |
} |
| 75 |
catch(e) |
| 76 |
{ |
| 77 |
} |
| 78 |
finally |
| 79 |
{ |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
expect = "No Exception"; |
| 84 |
try |
| 85 |
{ |
| 86 |
h(); |
| 87 |
actual = 'No Exception'; |
| 88 |
} |
| 89 |
catch(ex) |
| 90 |
{ |
| 91 |
actual = ex + ''; |
| 92 |
} |
| 93 |
reportCompare(expect, actual, summary); |
| 94 |
|
| 95 |
expect = |
| 96 |
'function h() {\n' + |
| 97 |
' try {\n' + |
| 98 |
' throw "foo";\n' + |
| 99 |
' } catch (e if e == "bar") {\n' + |
| 100 |
' } catch (e) {\n' + |
| 101 |
' } finally {\n' + |
| 102 |
' }\n' + |
| 103 |
'}'; |
| 104 |
|
| 105 |
actual = h + ''; |
| 106 |
reportCompare(expect, actual, summary); |
| 107 |
|
| 108 |
exitFunc ('test'); |
| 109 |
} |