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 @@ -790,6 +790,13 @@ if (typeof Symbol !== 'undefined') {
790
790
) ;
791
791
}
792
792
793
+ // Test circular Set
794
+ {
795
+ const set = new Set ( ) ;
796
+ set . add ( set ) ;
797
+ assert . strictEqual ( util . inspect ( set ) , 'Set { [Circular] }' ) ;
798
+ }
799
+
793
800
// test Map
794
801
{
795
802
assert . strictEqual ( util . inspect ( new Map ( ) ) , 'Map {}' ) ;
@@ -801,6 +808,18 @@ if (typeof Symbol !== 'undefined') {
801
808
'Map { \'foo\' => null, [size]: 1, bar: 42 }' ) ;
802
809
}
803
810
811
+ // Test circular Map
812
+ {
813
+ const map = new Map ( ) ;
814
+ map . set ( map , 'map' ) ;
815
+ assert . strictEqual ( util . inspect ( map ) , "Map { [Circular] => 'map' }" ) ;
816
+ map . set ( map , map ) ;
817
+ assert . strictEqual ( util . inspect ( map ) , 'Map { [Circular] => [Circular] }' ) ;
818
+ map . delete ( map ) ;
819
+ map . set ( 'map' , map ) ;
820
+ assert . strictEqual ( util . inspect ( map ) , "Map { 'map' => [Circular] }" ) ;
821
+ }
822
+
804
823
// test Promise
805
824
{
806
825
const resolved = Promise . resolve ( 3 ) ;
You can’t perform that action at this time.
0 commit comments