| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-354541-04.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 |
test(); |
| 15 |
|
| 16 |
|
| 17 |
function test() |
| 18 |
{ |
| 19 |
enterFunc ('test'); |
| 20 |
printBugNumber(BUGNUMBER); |
| 21 |
printStatus (summary + ': in function'); |
| 22 |
|
| 23 |
String.prototype.trim = function() { return 'hallo'; }; |
| 24 |
|
| 25 |
const S = String; |
| 26 |
const Sp = String.prototype; |
| 27 |
|
| 28 |
expect = 'hallo'; |
| 29 |
var expectStringInvariant = true; |
| 30 |
var actualStringInvariant; |
| 31 |
var expectStringPrototypeInvariant = true; |
| 32 |
var actualStringPrototypeInvariant; |
| 33 |
|
| 34 |
if (typeof Script == 'undefined') |
| 35 |
{ |
| 36 |
print('Test skipped. Script is not defined'); |
| 37 |
reportCompare("Script not defined, Test skipped.", |
| 38 |
"Script not defined, Test skipped.", |
| 39 |
summary); |
| 40 |
} |
| 41 |
else |
| 42 |
{ |
| 43 |
s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; actualStringInvariant = (String === S); actualStringPrototypeInvariant = (String.prototype === Sp); actual = "".trim();'); |
| 44 |
try |
| 45 |
{ |
| 46 |
s(); |
| 47 |
} |
| 48 |
catch(ex) |
| 49 |
{ |
| 50 |
actual = ex + ''; |
| 51 |
} |
| 52 |
|
| 53 |
reportCompare(expect, actual, 'trim() returned'); |
| 54 |
reportCompare(expectStringInvariant, actualStringInvariant, 'String invariant'); |
| 55 |
reportCompare(expectStringPrototypeInvariant, |
| 56 |
actualStringPrototypeInvariant, |
| 57 |
'String.prototype invariant'); |
| 58 |
} |
| 59 |
|
| 60 |
exitFunc ('test'); |
| 61 |
} |