OLD | NEW |
| (Empty) |
1 This performs a number of different tests on JavaScript getters and setters. | |
2 | |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
4 | |
5 | |
6 the get set object declaration syntax | |
7 PASS o1.b is 8 | |
8 PASS o1.b is 11 | |
9 __defineGetter__ and __defineSetter__ | |
10 PASS o2.b is 8 | |
11 PASS o2.b is 11 | |
12 Setting a value without having a setter | |
13 PASS o3.x = 10; o3.x is 42 | |
14 Getting a value without having a getter | |
15 PASS o4.x is undefined. | |
16 __lookupGetter__ and __lookupSetter__ | |
17 PASS o4.__lookupGetter__('b') is getB | |
18 PASS o4.__lookupSetter__('b') is setB | |
19 __defineGetter__ and __defineSetter__ with various invalid arguments | |
20 PASS o5.__defineSetter__('a', null) threw exception TypeError: invalid setter us
age. | |
21 PASS o5.__defineSetter__('a', o5) threw exception TypeError: invalid setter usag
e. | |
22 PASS o5.__defineGetter__('a', null) threw exception TypeError: invalid getter us
age. | |
23 PASS o5.__defineGetter__('a', o5) threw exception TypeError: invalid getter usag
e. | |
24 setters and getters with exceptions | |
25 PASS x = o6.x threw exception Exception in get. | |
26 PASS x is 0 | |
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. | |
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. | |
31 PASS o8.numSets is 0 | |
32 PASS typeof testObj.getter is 'string' | |
33 the get set with string property name | |
34 PASS o9.b is 8 | |
35 PASS o9.b is 11 | |
36 the get set with numeric property name | |
37 PASS o10[42] is 8 | |
38 PASS o10[42] is 11 | |
39 PASS successfullyParsed is true | |
40 | |
41 TEST COMPLETE | |
42 | |
OLD | NEW |