OLD | NEW |
1 This performs a number of different tests on JavaScript getters and setters. | 1 This performs a number of different tests on JavaScript getters and setters. |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 the get set object declaration syntax | 6 the get set object declaration syntax |
7 PASS o1.b is 8 | 7 PASS o1.b is 8 |
8 PASS o1.b is 11 | 8 PASS o1.b is 11 |
9 __defineGetter__ and __defineSetter__ | 9 __defineGetter__ and __defineSetter__ |
10 PASS o2.b is 8 | 10 PASS o2.b is 8 |
11 PASS o2.b is 11 | 11 PASS o2.b is 11 |
12 Setting a value without having a setter | 12 Setting a value without having a setter |
13 PASS o3.x = 10; threw exception TypeError: Cannot set property x of #<an Object>
which has only a getter. | 13 PASS o3.x = 10; threw exception TypeError: Cannot set property x of #<Object> wh
ich has only a getter. |
14 Getting a value without having a getter | 14 Getting a value without having a getter |
15 PASS o4.x is undefined. | 15 PASS o4.x is undefined. |
16 __lookupGetter__ and __lookupSetter__ | 16 __lookupGetter__ and __lookupSetter__ |
17 PASS o4.__lookupGetter__('b') is getB | 17 PASS o4.__lookupGetter__('b') is getB |
18 PASS o4.__lookupSetter__('b') is setB | 18 PASS o4.__lookupSetter__('b') is setB |
19 __defineGetter__ and __defineSetter__ with various invalid arguments | 19 __defineGetter__ and __defineSetter__ with various invalid arguments |
20 PASS o5.__defineSetter__('a', null) threw exception TypeError: Object.prototype.
__defineSetter__: Expecting function. | 20 PASS o5.__defineSetter__('a', null) threw exception TypeError: Object.prototype.
__defineSetter__: Expecting function. |
21 PASS o5.__defineSetter__('a', o5) threw exception TypeError: Object.prototype.__
defineSetter__: Expecting function. | 21 PASS o5.__defineSetter__('a', o5) threw exception TypeError: Object.prototype.__
defineSetter__: Expecting function. |
22 PASS o5.__defineGetter__('a', null) threw exception TypeError: Object.prototype.
__defineGetter__: Expecting function. | 22 PASS o5.__defineGetter__('a', null) threw exception TypeError: Object.prototype.
__defineGetter__: Expecting function. |
23 PASS o5.__defineGetter__('a', o5) threw exception TypeError: Object.prototype.__
defineGetter__: Expecting function. | 23 PASS o5.__defineGetter__('a', o5) threw exception TypeError: Object.prototype.__
defineGetter__: Expecting function. |
24 setters and getters with exceptions | 24 setters and getters with exceptions |
25 PASS x = o6.x threw exception Exception in get. | 25 PASS x = o6.x threw exception Exception in get. |
26 PASS x is 0 | 26 PASS x is 0 |
27 PASS o6.x = 42 threw exception Exception in set. | 27 PASS o6.x = 42 threw exception Exception in set. |
28 Defining a setter should also define a getter for the same property which return
s undefined. Thus, a getter defined on the prototype should not be called. | 28 Defining a setter should also define a getter for the same property which return
s undefined. Thus, a getter defined on the prototype should not be called. |
29 PASS o7.x is undefined. | 29 PASS o7.x is undefined. |
30 If an object has a property and its prototype has a setter function for that pro
perty, then setting the property should set the property directly and not call t
he setter function. | 30 If an object has a property and its prototype has a setter function for that pro
perty, then setting the property should set the property directly and not call t
he setter function. |
31 PASS o8.numSets is 0 | 31 PASS o8.numSets is 0 |
32 PASS typeof testObj.getter is 'string' | 32 PASS typeof testObj.getter is 'string' |
33 PASS successfullyParsed is true | 33 PASS successfullyParsed is true |
34 | 34 |
35 TEST COMPLETE | 35 TEST COMPLETE |
36 | 36 |
OLD | NEW |