| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-354541-03.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 354541; |
| 9 |
var summary = 'Regression to standard class constructors in case labels'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
|
| 14 |
printBugNumber(BUGNUMBER); |
| 15 |
printStatus (summary + ': top level'); |
| 16 |
|
| 17 |
String.prototype.trim = function() { print('hallo'); }; |
| 18 |
|
| 19 |
String.prototype.trim = function() { return 'hallo'; }; |
| 20 |
|
| 21 |
const S = String; |
| 22 |
const Sp = String.prototype; |
| 23 |
|
| 24 |
expect = 'hallo'; |
| 25 |
var expectStringInvariant = true |
| 26 |
var actualStringInvariant; |
| 27 |
var expectStringPrototypeInvariant = true; |
| 28 |
var actualStringPrototypeInvariant; |
| 29 |
|
| 30 |
if (typeof Script == 'undefined') |
| 31 |
{ |
| 32 |
print('Test skipped. Script not defined.'); |
| 33 |
reportCompare("Script not defined, Test skipped.", |
| 34 |
"Script not defined, Test skipped.", |
| 35 |
summary); |
| 36 |
} |
| 37 |
else |
| 38 |
{ |
| 39 |
var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; actualStringInvariant = (String === S); actualStringPrototypeInvariant = (String.prototype === Sp); actual = "".trim();'); |
| 40 |
try |
| 41 |
{ |
| 42 |
s(); |
| 43 |
} |
| 44 |
catch(ex) |
| 45 |
{ |
| 46 |
actual = ex + ''; |
| 47 |
} |
| 48 |
reportCompare(expect, actual, 'trim() returned'); |
| 49 |
reportCompare(expectStringInvariant, actualStringInvariant, |
| 50 |
'String invariant'); |
| 51 |
reportCompare(expectStringPrototypeInvariant, |
| 52 |
actualStringPrototypeInvariant, |
| 53 |
'String.prototype invariant'); |
| 54 |
|
| 55 |
} |
| 56 |
|