| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-365869.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 365869; |
| 9 |
var summary = 'strict warning for object literal with duplicate propery names'; |
| 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 |
if (!options().match(/strict/)) |
| 25 |
{ |
| 26 |
options('strict'); |
| 27 |
} |
| 28 |
if (!options().match(/werror/)) |
| 29 |
{ |
| 30 |
options('werror'); |
| 31 |
} |
| 32 |
|
| 33 |
try |
| 34 |
{ |
| 35 |
expect = 'TypeError: redeclaration of property a'; |
| 36 |
var o = {a:4, a:5}; |
| 37 |
|
| 38 |
actual = 'No warning'; |
| 39 |
} |
| 40 |
catch(ex) |
| 41 |
{ |
| 42 |
actual = ex + ''; |
| 43 |
print(ex); |
| 44 |
} |
| 45 |
|
| 46 |
reportCompare(expect, actual, summary); |
| 47 |
|
| 48 |
print('test crash from bug 371292 Comment 3'); |
| 49 |
|
| 50 |
try |
| 51 |
{ |
| 52 |
expect = 'TypeError: redeclaration of property 1'; |
| 53 |
var o1 = {1:1, 1:2}; |
| 54 |
|
| 55 |
actual = 'No warning'; |
| 56 |
} |
| 57 |
catch(ex) |
| 58 |
{ |
| 59 |
actual = ex + ''; |
| 60 |
print(ex); |
| 61 |
} |
| 62 |
|
| 63 |
reportCompare(expect, actual, summary); |
| 64 |
|
| 65 |
|
| 66 |
print('test crash from bug 371292 Comment 9'); |
| 67 |
|
| 68 |
try |
| 69 |
{ |
| 70 |
expect = 'TypeError: redeclaration of const 5'; |
| 71 |
"012345".__defineSetter__(5, function(){}); |
| 72 |
} |
| 73 |
catch(ex) |
| 74 |
{ |
| 75 |
actual = ex + ''; |
| 76 |
print(ex); |
| 77 |
} |
| 78 |
|
| 79 |
reportCompare(expect, actual, summary); |
| 80 |
|
| 81 |
|
| 82 |
exitFunc ('test'); |
| 83 |
} |