File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -799,6 +799,13 @@ if (typeof Symbol !== 'undefined') {
799
799
) ;
800
800
}
801
801
802
+ // Test circular Set
803
+ {
804
+ const set = new Set ( ) ;
805
+ set . add ( set ) ;
806
+ assert . strictEqual ( util . inspect ( set ) , 'Set { [Circular] }' ) ;
807
+ }
808
+
802
809
// test Map
803
810
{
804
811
assert . strictEqual ( util . inspect ( new Map ( ) ) , 'Map {}' ) ;
@@ -810,6 +817,18 @@ if (typeof Symbol !== 'undefined') {
810
817
'Map { \'foo\' => null, [size]: 1, bar: 42 }' ) ;
811
818
}
812
819
820
+ // Test circular Map
821
+ {
822
+ const map = new Map ( ) ;
823
+ map . set ( map , 'map' ) ;
824
+ assert . strictEqual ( util . inspect ( map ) , "Map { [Circular] => 'map' }" ) ;
825
+ map . set ( map , map ) ;
826
+ assert . strictEqual ( util . inspect ( map ) , 'Map { [Circular] => [Circular] }' ) ;
827
+ map . delete ( map ) ;
828
+ map . set ( 'map' , map ) ;
829
+ assert . strictEqual ( util . inspect ( map ) , "Map { 'map' => [Circular] }" ) ;
830
+ }
831
+
813
832
// test Promise
814
833
{
815
834
const resolved = Promise . resolve ( 3 ) ;
You can’t perform that action at this time.
0 commit comments