| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-333541.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 333541; |
| 9 |
var summary = '1..toSource()'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
printBugNumber(BUGNUMBER); |
| 14 |
printStatus (summary); |
| 15 |
|
| 16 |
function a(){ |
| 17 |
return 1..toSource(); |
| 18 |
} |
| 19 |
|
| 20 |
try |
| 21 |
{ |
| 22 |
expect = 'function a() {\n return (1).toSource();\n}'; |
| 23 |
actual = a.toString(); |
| 24 |
compareSource(expect, actual, summary + ': 1'); |
| 25 |
} |
| 26 |
catch(ex) |
| 27 |
{ |
| 28 |
actual = ex + ''; |
| 29 |
reportCompare(expect, actual, summary + ': 1'); |
| 30 |
} |
| 31 |
|
| 32 |
try |
| 33 |
{ |
| 34 |
expect = 'function a() {return (1).toSource();}'; |
| 35 |
actual = a.toSource(); |
| 36 |
compareSource(expect, actual, summary + ': 2'); |
| 37 |
} |
| 38 |
catch(ex) |
| 39 |
{ |
| 40 |
actual = ex + ''; |
| 41 |
reportCompare(expect, actual, summary + ': 2'); |
| 42 |
} |
| 43 |
|
| 44 |
expect = a; |
| 45 |
actual = a.valueOf(); |
| 46 |
reportCompare(expect, actual, summary + ': 3'); |
| 47 |
|
| 48 |
try |
| 49 |
{ |
| 50 |
expect = 'function a() {\n return (1).toSource();\n}'; |
| 51 |
actual = "" + a; |
| 52 |
compareSource(expect, actual, summary + ': 4'); |
| 53 |
} |
| 54 |
catch(ex) |
| 55 |
{ |
| 56 |
actual = ex + ''; |
| 57 |
reportCompare(expect, actual, summary + ': 4'); |
| 58 |
} |
| 59 |
|
| 60 |
function b(){ |
| 61 |
x=1..toSource(); |
| 62 |
x=1['a']; |
| 63 |
x=1..a; |
| 64 |
x=1['"a"']; |
| 65 |
x=1["'a'"]; |
| 66 |
x=1['1']; |
| 67 |
x=1["#"]; |
| 68 |
} |
| 69 |
|
| 70 |
try |
| 71 |
{ |
| 72 |
expect = "function b() {\n x = (1).toSource();\n" + |
| 73 |
" x = (1).a;\n" + |
| 74 |
" x = (1).a;\n" + |
| 75 |
" x = (1)['\"a\"'];\n" + |
| 76 |
" x = (1)[\'\\'a\\''];\n" + |
| 77 |
" x = (1)['1'];\n" + |
| 78 |
" x = (1)['#'];\n" + |
| 79 |
"}"; |
| 80 |
actual = "" + b; |
| 81 |
|
| 82 |
|
| 83 |
actual = actual.replace(/\(1\)\[1\];/, "(1)['1'];"); |
| 84 |
compareSource(expect, actual, summary + ': 5'); |
| 85 |
} |
| 86 |
catch(ex) |
| 87 |
{ |
| 88 |
actual = ex + ''; |
| 89 |
reportCompare(expect, actual, summary + ': 5'); |
| 90 |
} |
| 91 |
|