| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-352197.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 352197; |
| 9 |
var summary = 'Strict warning for return e; vs. return;'; |
| 10 |
var actual = ''; |
| 11 |
var expect = 'TypeError: function f does not always return a value'; |
| 12 |
|
| 13 |
printBugNumber(BUGNUMBER); |
| 14 |
printStatus (summary); |
| 15 |
|
| 16 |
if (!options().match(/strict/)) |
| 17 |
{ |
| 18 |
options('strict'); |
| 19 |
} |
| 20 |
if (!options().match(/werror/)) |
| 21 |
{ |
| 22 |
options('werror'); |
| 23 |
} |
| 24 |
|
| 25 |
try |
| 26 |
{ |
| 27 |
eval('function f() { if (x) return y; }'); |
| 28 |
} |
| 29 |
catch(ex) |
| 30 |
{ |
| 31 |
actual = ex + ''; |
| 32 |
} |
| 33 |
|
| 34 |
reportCompare(expect, actual, summary + ': 1'); |
| 35 |
|
| 36 |
try |
| 37 |
{ |
| 38 |
eval('function f() { if (x) { return y; } }'); |
| 39 |
} |
| 40 |
catch(ex) |
| 41 |
{ |
| 42 |
actual = ex + ''; |
| 43 |
} |
| 44 |
|
| 45 |
reportCompare(expect, actual, summary + ': 2'); |
| 46 |
|
| 47 |
var f; |
| 48 |
expect = 'TypeError: function anonymous does not always return a value'; |
| 49 |
|
| 50 |
try |
| 51 |
{ |
| 52 |
f = Function('if (x) return y;'); |
| 53 |
} |
| 54 |
catch(ex) |
| 55 |
{ |
| 56 |
actual = ex + ''; |
| 57 |
} |
| 58 |
|
| 59 |
reportCompare(expect, actual, summary + ': 3'); |
| 60 |
|
| 61 |
try |
| 62 |
{ |
| 63 |
f = Function('if (x) { return y; }'); |
| 64 |
} |
| 65 |
catch(ex) |
| 66 |
{ |
| 67 |
actual = ex + ''; |
| 68 |
} |
| 69 |
|
| 70 |
reportCompare(expect, actual, summary + ': 4'); |