@@ -192,17 +192,29 @@ describe('Generic', function () {
192192 assert ( eql ( new BaseA ( 1 ) , new BaseA ( 1 ) ) , 'eql(new BaseA(1), new BaseA(1))' ) ;
193193 } ) ;
194194
195+ it ( 'returns true given two class instances with deeply equal bases' , function ( ) {
196+ function BaseA ( ) { }
197+ function BaseB ( ) { }
198+ BaseA . prototype . foo = { a : 1 } ;
199+ BaseB . prototype . foo = { a : 1 } ;
200+ assert ( eql ( new BaseA ( ) , new BaseB ( ) ) === true ,
201+ 'eql(new <base with .prototype.foo = { a: 1 }>, new <base with .prototype.foo = { a: 1 }>) === true' ) ;
202+ } ) ;
203+
195204 it ( 'returns false given two class instances with different properties' , function ( ) {
196205 function BaseA ( prop ) {
197206 this . prop = prop ;
198207 }
199208 assert ( eql ( new BaseA ( 1 ) , new BaseA ( 2 ) ) === false , 'eql(new BaseA(1), new BaseA(2)) === false' ) ;
200209 } ) ;
201210
202- it ( 'returns false given two different empty class instances' , function ( ) {
211+ it ( 'returns false given two class instances with deeply unequal bases ' , function ( ) {
203212 function BaseA ( ) { }
204213 function BaseB ( ) { }
205- assert ( eql ( new BaseA ( ) , new BaseB ( ) ) === false , 'eql(new BaseA(), new BaseB()) === false' ) ;
214+ BaseA . prototype . foo = { a : 1 } ;
215+ BaseB . prototype . foo = { a : 2 } ;
216+ assert ( eql ( new BaseA ( ) , new BaseB ( ) ) === false ,
217+ 'eql(new <base with .prototype.foo = { a: 1 }>, new <base with .prototype.foo = { a: 2 }>) === false' ) ;
206218 } ) ;
207219
208220 } ) ;
@@ -283,6 +295,13 @@ describe('Generic', function () {
283295 'eql({ foo: 1, bar: objectC }, { foo: 1, bar: objectC }) === true' ) ;
284296 } ) ;
285297
298+ it ( 'returns true with objects with deeply equal prototypes' , function ( ) {
299+ var objectA = Object . create ( { foo : { a : 1 } } ) ;
300+ var objectB = Object . create ( { foo : { a : 1 } } ) ;
301+ assert ( eql ( objectA , objectB ) === true ,
302+ 'eql(Object.create({ foo: { a: 1 } }), Object.create({ foo: { a: 1 } })) === true' ) ;
303+ } ) ;
304+
286305 it ( 'returns false with objects containing different literals' , function ( ) {
287306 assert ( eql ( { foo : 1 , bar : 1 } , { foo : 1 , bar : 2 } ) === false ,
288307 'eql({ foo: 1, bar: 2 }, { foo: 1, bar: 2 }) === false' ) ;
@@ -306,6 +325,13 @@ describe('Generic', function () {
306325 'eql({ foo: 1, bar: -> }, { foo: 1, bar: <- }) === true' ) ;
307326 } ) ;
308327
328+ it ( 'returns false with objects with deeply unequal prototypes' , function ( ) {
329+ var objectA = Object . create ( { foo : { a : 1 } } ) ;
330+ var objectB = Object . create ( { foo : { a : 2 } } ) ;
331+ assert ( eql ( objectA , objectB ) === false ,
332+ 'eql(Object.create({ foo: { a: 1 } }), Object.create({ foo: { a: 2 } })) === false' ) ;
333+ } ) ;
334+
309335 } ) ;
310336
311337 describe ( 'functions' , function ( ) {
0 commit comments