@@ -159,15 +159,17 @@ assertNotDeepOrStrict(new Set([1, 2, 3, 4]), new Set([1, 2, 3]));
159159assertDeepAndStrictEqual ( new Set ( [ '1' , '2' , '3' ] ) , new Set ( [ '1' , '2' , '3' ] ) ) ;
160160assertDeepAndStrictEqual ( new Set ( [ [ 1 , 2 ] , [ 3 , 4 ] ] ) , new Set ( [ [ 3 , 4 ] , [ 1 , 2 ] ] ) ) ;
161161
162- const a = [ 1 , 2 ] ;
163- const b = [ 3 , 4 ] ;
164- const c = [ 1 , 2 ] ;
165- const d = [ 3 , 4 ] ;
166-
167- assertDeepAndStrictEqual (
168- { a : a , b : b , s : new Set ( [ a , b ] ) } ,
169- { a : c , b : d , s : new Set ( [ d , c ] ) }
170- ) ;
162+ {
163+ const a = [ 1 , 2 ] ;
164+ const b = [ 3 , 4 ] ;
165+ const c = [ 1 , 2 ] ;
166+ const d = [ 3 , 4 ] ;
167+
168+ assertDeepAndStrictEqual (
169+ { a : a , b : b , s : new Set ( [ a , b ] ) } ,
170+ { a : c , b : d , s : new Set ( [ d , c ] ) }
171+ ) ;
172+ }
171173
172174assertDeepAndStrictEqual ( new Map ( [ [ 1 , 1 ] , [ 2 , 2 ] ] ) , new Map ( [ [ 1 , 1 ] , [ 2 , 2 ] ] ) ) ;
173175assertDeepAndStrictEqual ( new Map ( [ [ 1 , 1 ] , [ 2 , 2 ] ] ) , new Map ( [ [ 2 , 2 ] , [ 1 , 1 ] ] ) ) ;
@@ -303,7 +305,26 @@ assertOnlyDeepEqual(
303305 new Set ( [ undefined ] )
304306) ;
305307
306- // Circular structures
308+ // GH-6416. Make sure circular refs don't throw.
309+ {
310+ const b = { } ;
311+ b . b = b ;
312+ const c = { } ;
313+ c . b = c ;
314+
315+ assertDeepAndStrictEqual ( b , c ) ;
316+
317+ const d = { } ;
318+ d . a = 1 ;
319+ d . b = d ;
320+ const e = { } ;
321+ e . a = 1 ;
322+ e . b = { } ;
323+
324+ assertNotDeepOrStrict ( d , e ) ;
325+ }
326+
327+ // GH-14441. Circular structures should be consistent
307328{
308329 const a = { } ;
309330 const b = { } ;
@@ -323,6 +344,27 @@ assertOnlyDeepEqual(
323344 assertDeepAndStrictEqual ( b , c ) ;
324345}
325346
347+ // GH-7178. Ensure reflexivity of deepEqual with `arguments` objects.
348+ {
349+ const args = ( function ( ) { return arguments ; } ) ( ) ;
350+ assertNotDeepOrStrict ( [ ] , args ) ;
351+ }
352+
353+ // More checking that arguments objects are handled correctly
354+ {
355+ // eslint-disable-next-line func-style
356+ const returnArguments = function ( ) { return arguments ; } ;
357+
358+ const someArgs = returnArguments ( 'a' ) ;
359+ const sameArgs = returnArguments ( 'a' ) ;
360+ const diffArgs = returnArguments ( 'b' ) ;
361+
362+ assertNotDeepOrStrict ( someArgs , [ 'a' ] ) ;
363+ assertNotDeepOrStrict ( someArgs , { '0' : 'a' } ) ;
364+ assertNotDeepOrStrict ( someArgs , diffArgs ) ;
365+ assertDeepAndStrictEqual ( someArgs , sameArgs ) ;
366+ }
367+
326368{
327369 const values = [
328370 123 ,
0 commit comments