@@ -97,6 +97,14 @@ describe('ES2015 Specific', function () {
9797 assert ( eql ( mapA , mapB ) , 'eql(Map { a => 1, b => 2, c => 3 }, Map { a => 1, b => 2, c => 3 })' ) ;
9898 } ) ;
9999
100+ ( setExists ? it : it . skip ) ( 'returns false for fake Maps' , function ( ) {
101+ var maplikeSet = new Set ( ) ;
102+ Object . defineProperty ( maplikeSet , 'constructor' , { enumerable : false , value : Map } ) ;
103+ Object . setPrototypeOf ( maplikeSet , Map . prototype ) ;
104+
105+ assert ( eql ( maplikeSet , new Map ( ) ) === false , 'eql(Set pretending to be a Map, Map { })' ) ;
106+ } ) ;
107+
100108 } ) ;
101109
102110 describeIf ( symbolAndMapExist && typeof Map . prototype [ Symbol . iterator ] === 'function' ) ( 'map iterator' , function ( ) {
@@ -240,6 +248,14 @@ describe('ES2015 Specific', function () {
240248 assert ( eql ( setA , setB ) === true , 'eql(Set { -> }, Set { <- }) === true' ) ;
241249 } ) ;
242250
251+ ( mapExists ? it : it . skip ) ( 'returns false for fake Sets' , function ( ) {
252+ var setlikeMap = new Map ( ) ;
253+ Object . defineProperty ( setlikeMap , 'constructor' , { enumerable : false , value : Set } ) ;
254+ Object . setPrototypeOf ( setlikeMap , Set . prototype ) ;
255+
256+ assert ( eql ( setlikeMap , new Set ( ) ) === false , 'eql(Map pretending to be a Set, Set { })' ) ;
257+ } ) ;
258+
243259 } ) ;
244260
245261 describeIf ( symbolAndSetExist && typeof Set . prototype [ Symbol . iterator ] === 'function' ) ( 'set iterator' , function ( ) {
0 commit comments