@@ -66,7 +66,19 @@ test('arguments class', function (t) {
6666test ( 'dates' ,  function  ( t )  { 
6767  var  d0  =  new  Date ( 1387585278000 ) ; 
6868  var  d1  =  new  Date ( 'Fri Dec 20 2013 16:21:18 GMT-0800 (PST)' ) ; 
69-   t . ok ( equal ( d0 ,  d1 ) ) ; 
69+ 
70+   t . ok ( equal ( d0 ,  d1 ) ,  'two dates with the same timestamp are equal' ) ; 
71+   t . ok ( equal ( d1 ,  d0 ) ,  'two dates with the same timestamp are equal' ) ; 
72+   t . ok ( equal ( d0 ,  d1 ,  {  strict : true  } ) ,  'strict: two dates with the same timestamp are equal' ) ; 
73+   t . ok ( equal ( d1 ,  d0 ,  {  strict : true  } ) ,  'strict: two dates with the same timestamp are equal' ) ; 
74+ 
75+   d1 . a  =  true ; 
76+ 
77+   t . notOk ( equal ( d0 ,  d1 ) ,  'two dates with the same timestamp but different own properties are not equal' ) ; 
78+   t . notOk ( equal ( d1 ,  d0 ) ,  'two dates with the same timestamp but different own properties are not equal' ) ; 
79+   t . notOk ( equal ( d0 ,  d1 ,  {  strict : true  } ) ,  'strict: two dates with the same timestamp but different own properties are not equal' ) ; 
80+   t . notOk ( equal ( d1 ,  d0 ,  {  strict : true  } ) ,  'strict: two dates with the same timestamp but different own properties are not equal' ) ; 
81+ 
7082  t . end ( ) ; 
7183} ) ; 
7284
@@ -316,3 +328,36 @@ test('arrays and objects', function (t) {
316328
317329  t . end ( ) ; 
318330} ) ; 
331+ 
332+ test ( '[[Prototypes]]' ,  {  skip : ! Object . getPrototypeOf  } ,  function  ( t )  { 
333+   function  C ( )  { } 
334+   var  instance  =  new  C ( ) ; 
335+   delete  instance . constructor ; 
336+ 
337+   t . notOk ( equal ( { } ,  instance ) ,  'two identical objects with different [[Prototypes]] are not equal' ) ; 
338+   t . notOk ( equal ( { } ,  instance ,  {  strict : true  } ) ,  'strict: two identical objects with different [[Prototypes]] are not equal' ) ; 
339+ 
340+   t . test ( 'Dates with different prototypes' ,  {  skip : ! Object . setPrototypeOf  } ,  function  ( st )  { 
341+     var  d1  =  new  Date ( 0 ) ; 
342+     var  d2  =  new  Date ( 0 ) ; 
343+ 
344+     st . ok ( equal ( d1 ,  d2 ) ,  'two dates with the same timestamp are equal' ) ; 
345+     st . ok ( equal ( d2 ,  d1 ) ,  'two dates with the same timestamp are equal' ) ; 
346+     st . ok ( equal ( d1 ,  d2 ,  {  strict : true  } ) ,  'strict: two dates with the same timestamp are equal' ) ; 
347+     st . ok ( equal ( d1 ,  d1 ,  {  strict : true  } ) ,  'strict: two dates with the same timestamp are equal' ) ; 
348+ 
349+     var  newProto  =  { } ; 
350+     Object . setPrototypeOf ( newProto ,  Date . prototype ) ; 
351+     Object . setPrototypeOf ( d2 ,  newProto ) ; 
352+     st . ok ( d2  instanceof  Date ,  'd2 is still a Date instance' ) ; 
353+ 
354+     st . ok ( equal ( d1 ,  d2 ) ,  'two dates with the same timestamp and different [[Prototype]] are equal' ) ; 
355+     st . ok ( equal ( d2 ,  d1 ) ,  'two dates with the same timestamp and different [[Prototype]] are equal' ) ; 
356+     st . notOk ( equal ( d1 ,  d2 ,  {  strict : true  } ) ,  'strict: two dates with the same timestamp and different [[Prototype]] are not equal' ) ; 
357+     st . notOk ( equal ( d2 ,  d1 ,  {  strict : true  } ) ,  'strict: two dates with the same timestamp and different [[Prototype]] are not equal' ) ; 
358+ 
359+     st . end ( ) ; 
360+   } ) ; 
361+ 
362+   t . end ( ) ; 
363+ } ) ; 
0 commit comments