| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
var gTestfile = 'regress-191276.js'; |
| 20 |
var UBound = 0; |
| 21 |
var BUGNUMBER = 191276; |
| 22 |
var summary = 'Testing |this[name]| via Function.prototype.call(), apply()'; |
| 23 |
var status = ''; |
| 24 |
var statusitems = []; |
| 25 |
var actual = ''; |
| 26 |
var actualvalues = []; |
| 27 |
var expect= ''; |
| 28 |
var expectedvalues = []; |
| 29 |
|
| 30 |
|
| 31 |
function F(name) |
| 32 |
{ |
| 33 |
return this[name]; |
| 34 |
} |
| 35 |
|
| 36 |
function unused_function() |
| 37 |
{ |
| 38 |
F('a'); |
| 39 |
} |
| 40 |
|
| 41 |
status = inSection(1); |
| 42 |
actual = F.call({a: 'aaa'}, 'a'); |
| 43 |
expect = 'aaa'; |
| 44 |
addThis(); |
| 45 |
|
| 46 |
status = inSection(2); |
| 47 |
actual = F.apply({a: 'aaa'}, ['a']); |
| 48 |
expect = 'aaa'; |
| 49 |
addThis(); |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
var obj = {a: 'aaa'}; |
| 55 |
|
| 56 |
status = inSection(3); |
| 57 |
actual = F.call(obj, 'a'); |
| 58 |
expect = 'aaa'; |
| 59 |
addThis(); |
| 60 |
|
| 61 |
status = inSection(4); |
| 62 |
actual = F.apply(obj, ['a']); |
| 63 |
expect = 'aaa'; |
| 64 |
addThis(); |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
test(); |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
function addThis() |
| 75 |
{ |
| 76 |
statusitems[UBound] = status; |
| 77 |
actualvalues[UBound] = actual; |
| 78 |
expectedvalues[UBound] = expect; |
| 79 |
UBound++; |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
function test() |
| 84 |
{ |
| 85 |
enterFunc('test'); |
| 86 |
printBugNumber(BUGNUMBER); |
| 87 |
printStatus(summary); |
| 88 |
|
| 89 |
for (var i=0; i<UBound; i++) |
| 90 |
{ |
| 91 |
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); |
| 92 |
} |
| 93 |
|
| 94 |
exitFunc ('test'); |
| 95 |
} |