| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = '8.6.1-01.js'; |
| 7 |
|
| 8 |
|
| 9 |
var BUGNUMBER = 315436; |
| 10 |
var summary = 'In strict mode, setting a read-only property should generate a warning'; |
| 11 |
|
| 12 |
printBugNumber(BUGNUMBER); |
| 13 |
printStatus (summary); |
| 14 |
|
| 15 |
enterFunc (String (BUGNUMBER)); |
| 16 |
|
| 17 |
|
| 18 |
var actual = ''; |
| 19 |
var expect = 's.length is read-only'; |
| 20 |
var status = summary + ': Throw if STRICT and WERROR is enabled'; |
| 21 |
|
| 22 |
if (!options().match(/strict/)) |
| 23 |
{ |
| 24 |
options('strict'); |
| 25 |
} |
| 26 |
if (!options().match(/werror/)) |
| 27 |
{ |
| 28 |
options('werror'); |
| 29 |
} |
| 30 |
|
| 31 |
try |
| 32 |
{ |
| 33 |
var s = new String ('abc'); |
| 34 |
s.length = 0; |
| 35 |
} |
| 36 |
catch (e) |
| 37 |
{ |
| 38 |
actual = e.message; |
| 39 |
} |
| 40 |
|
| 41 |
reportCompare(expect, actual, status); |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
actual = 'did not throw'; |
| 46 |
expect = 'did not throw'; |
| 47 |
var status = summary + ': Do not throw if STRICT is enabled and WERROR is disabled'; |
| 48 |
|
| 49 |
|
| 50 |
options('werror'); |
| 51 |
|
| 52 |
try |
| 53 |
{ |
| 54 |
s.length = 0; |
| 55 |
} |
| 56 |
catch (e) |
| 57 |
{ |
| 58 |
actual = e.message; |
| 59 |
} |
| 60 |
|
| 61 |
reportCompare(expect, actual, status); |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
actual = 'did not throw'; |
| 66 |
expect = 'did not throw'; |
| 67 |
var status = summary + ': Do not throw if not in strict mode'; |
| 68 |
|
| 69 |
|
| 70 |
options('strict'); |
| 71 |
|
| 72 |
try |
| 73 |
{ |
| 74 |
s.length = 0; |
| 75 |
} |
| 76 |
catch (e) |
| 77 |
{ |
| 78 |
actual = e.message; |
| 79 |
} |
| 80 |
|
| 81 |
reportCompare(expect, actual, status); |