@@ -228,3 +228,46 @@ test('zeroes', function (t) {
228228
229229 t . end ( ) ;
230230} ) ;
231+
232+ test ( 'test objects' , { skip : ! Object . create } , function ( t ) {
233+ var a = { a : 'A' } ;
234+ var b = Object . create ( a ) ;
235+ b . b = 'B' ;
236+ var c = Object . create ( a ) ;
237+ c . b = 'C' ;
238+
239+ t . notOk ( equal ( b , c ) , 'two objects with the same [[Prototype]] but a different own property are not equal' ) ;
240+ t . notOk ( equal ( c , b ) , 'two objects with the same [[Prototype]] but a different own property are not equal' ) ;
241+
242+ t . notOk ( equal ( b , c , { strict : true } ) , 'strict: two objects with the same [[Prototype]] but a different own property are not equal' ) ;
243+ t . notOk ( equal ( c , b , { strict : true } ) , 'strict: two objects with the same [[Prototype]] but a different own property are not equal' ) ;
244+
245+ t . end ( ) ;
246+ } ) ;
247+
248+ test ( 'regexes vs dates' , function ( t ) {
249+ var d = new Date ( 1387585278000 ) ;
250+ var r = / a b c / ;
251+
252+ t . notOk ( equal ( d , r ) , 'date and regex are not equal' ) ;
253+ t . notOk ( equal ( r , d ) , 'regex and date are not equal' ) ;
254+
255+ t . notOk ( equal ( d , r , { strict : true } ) , 'strict: date and regex are not equal' ) ;
256+ t . notOk ( equal ( r , d , { strict : true } ) , 'strict: regex and date are not equal' ) ;
257+
258+ t . end ( ) ;
259+ } ) ;
260+
261+ test ( 'regexen' , function ( t ) {
262+ t . notOk ( equal ( / a b c / , / x y z / ) , 'two different regexes are not equal' ) ;
263+ t . notOk ( equal ( / x y z / , / a b c / ) , 'two different regexes are not equal' ) ;
264+ t . ok ( equal ( / a b c / , / a b c / ) , 'two same regexes are equal' ) ;
265+ t . ok ( equal ( / x y z / , / x y z / ) , 'two same regexes are equal' ) ;
266+
267+ t . notOk ( equal ( / a b c / , / x y z / , { strict : true } ) , 'strict: two different regexes are not equal' ) ;
268+ t . notOk ( equal ( / x y z / , / a b c / , { strict : true } ) , 'strict: two different regexes are not equal' ) ;
269+ t . ok ( equal ( / a b c / , / a b c / , { strict : true } ) , 'strict: two same regexes are not equal' ) ;
270+ t . ok ( equal ( / x y z / , / x y z / , { strict : true } ) , 'strict: two same regexes are not equal' ) ;
271+
272+ t . end ( ) ;
273+ } ) ;
0 commit comments