@@ -20,22 +20,36 @@ test("property enumeration", function() {
2020} ) ;
2121
2222test ( "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+
2536 var keys = [ ] ;
26- var fruits = [ 'apple' , 'orange' ] ;
27- for ( propertyName in fruits ) {
37+ for ( propertyName in b ) {
2838 keys . push ( propertyName ) ;
2939 }
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?' ) ;
3142
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.
3245 var ownKeys = [ ] ;
33- for ( propertyName in fruits ) {
34- if ( fruits . hasOwnProperty ( propertyName ) ) {
46+ for ( propertyName in b ) {
47+ if ( b . hasOwnProperty ( propertyName ) ) {
3548 ownKeys . push ( propertyName ) ;
3649 }
3750 }
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?' ) ;
3953} ) ;
4054
4155test ( "eval" , function ( ) {
0 commit comments