|
1 // vim: set ts=8 sts=4 et sw=4 tw=99: |
|
2 |
|
3 function testUKeyUObject(a, key1, key2, key3) { |
|
4 a.a = function () { return this.d; } |
|
5 a.b = function () { return this.e; } |
|
6 a.c = function() { return this.f; } |
|
7 a.d = 20; |
|
8 a.e = "hi"; |
|
9 a.f = 500; |
|
10 delete a["b"]; |
|
11 Object.defineProperty(a, "b", { get: function () { return function () { return this.e; } } }); |
|
12 assertEq(a[key1](), 20); |
|
13 assertEq(a[key2](), "hi"); |
|
14 assertEq(a[key3](), 500); |
|
15 } |
|
16 |
|
17 for (var i = 0; i < 5; i++) |
|
18 testUKeyUObject({}, "a", "b", "c"); |
|
19 |
|
20 |