@@ -20,22 +20,36 @@ test("property enumeration", function() {
20
20
} ) ;
21
21
22
22
test ( "hasOwnProperty" , function ( ) {
23
- // hasOwnProperty returns true if the parameter is a property directly on the object,
24
- // but not if it is a property accessible via the prototype chain.
23
+
24
+ var A = function ( ) {
25
+ this . aprop = "A" ;
26
+ } ;
27
+
28
+ var B = function ( ) {
29
+ this . bprop = "B" ;
30
+ } ;
31
+
32
+ B . prototype = new A ( ) ;
33
+
34
+ var b = new B ( ) ;
35
+
25
36
var keys = [ ] ;
26
- var fruits = [ 'apple' , 'orange' ] ;
27
- for ( propertyName in fruits ) {
37
+ for ( propertyName in b ) {
28
38
keys . push ( propertyName ) ;
29
39
}
30
- ok ( keys . equalTo ( [ '__' , '__' , '__' ] ) , 'what are the properties of the array?' ) ;
40
+ equals ( keys . length , __ , 'how many elements are in the keys array?' ) ;
41
+ ok ( keys . equalTo ( [ __ , __ ] ) , 'what are the properties of the array?' ) ;
31
42
43
+ // hasOwnProperty returns true if the parameter is a property directly on the object,
44
+ // but not if it is a property accessible via the prototype chain.
32
45
var ownKeys = [ ] ;
33
- for ( propertyName in fruits ) {
34
- if ( fruits . hasOwnProperty ( propertyName ) ) {
46
+ for ( propertyName in b ) {
47
+ if ( b . hasOwnProperty ( propertyName ) ) {
35
48
ownKeys . push ( propertyName ) ;
36
49
}
37
50
}
38
- ok ( ownKeys . equalTo ( [ '__' , '__' ] ) , 'what are the own properties of the array?' ) ;
51
+ equals ( ownKeys . length , __ , 'how many elements are in the ownKeys array?' ) ;
52
+ ok ( ownKeys . equalTo ( [ __ , __ ] ) , 'what are the own properties of the array?' ) ;
39
53
} ) ;
40
54
41
55
test ( "eval" , function ( ) {
0 commit comments