| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-164697.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 164697; |
| 9 |
var summary = '(instance.__parent__ == constructor.__parent__)'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
printBugNumber(BUGNUMBER); |
| 14 |
printStatus (summary); |
| 15 |
|
| 16 |
expect = 'true'; |
| 17 |
|
| 18 |
runtest('{}', 'Object'); |
| 19 |
runtest('new Object()', 'Object'); |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
actual = (function (){}).__proto__ == Function.prototype; |
| 24 |
reportCompare('true', actual+'', |
| 25 |
'(function (){}).__proto__ == Function.prototype'); |
| 26 |
|
| 27 |
runtest('new Function(";")', 'Function'); |
| 28 |
|
| 29 |
runtest('[]', 'Array'); |
| 30 |
runtest('new Array()', 'Array'); |
| 31 |
|
| 32 |
runtest('""', 'String'); |
| 33 |
runtest('new String()', 'String'); |
| 34 |
|
| 35 |
runtest('true', 'Boolean'); |
| 36 |
runtest('new Boolean()', 'Boolean'); |
| 37 |
|
| 38 |
runtest('1', 'Number'); |
| 39 |
runtest('new Number("1")', 'Number'); |
| 40 |
|
| 41 |
runtest('new Date()', 'Date'); |
| 42 |
|
| 43 |
runtest('/x/', 'RegExp'); |
| 44 |
runtest('new RegExp("x")', 'RegExp'); |
| 45 |
|
| 46 |
runtest('new Error()', 'Error'); |
| 47 |
|
| 48 |
function runtest(myinstance, myconstructor) |
| 49 |
{ |
| 50 |
var expr; |
| 51 |
var actual; |
| 52 |
|
| 53 |
try |
| 54 |
{ |
| 55 |
expr = '(' + myinstance + ').__parent__ == ' + |
| 56 |
myconstructor + '.__parent__'; |
| 57 |
printStatus(expr); |
| 58 |
actual = eval(expr).toString(); |
| 59 |
} |
| 60 |
catch(ex) |
| 61 |
{ |
| 62 |
actual = ex + ''; |
| 63 |
} |
| 64 |
|
| 65 |
reportCompare(expect, actual, expr); |
| 66 |
|
| 67 |
try |
| 68 |
{ |
| 69 |
expr = '(' + myinstance + ').__proto__ == ' + |
| 70 |
myconstructor + '.prototype'; |
| 71 |
printStatus(expr); |
| 72 |
actual = eval(expr).toString(); |
| 73 |
} |
| 74 |
catch(ex) |
| 75 |
{ |
| 76 |
actual = ex + ''; |
| 77 |
} |
| 78 |
|
| 79 |
reportCompare(expect, actual, expr); |
| 80 |
} |