@@ -3,6 +3,18 @@ require('./_tape');
33var assign = require ( 'object.assign' ) ;
44var hasSymbols = require ( 'has-symbols' ) ( ) ;
55
6+ function tag ( obj , value ) {
7+ if ( hasSymbols && Symbol . toStringTags && Object . defineProperty ) {
8+ Object . defineProperty ( obj , Symbol . toStringTag , {
9+ value : value
10+ } ) ;
11+ }
12+ return obj ;
13+ }
14+
15+ // eslint-disable-next-line no-proto
16+ var hasDunderProto = [ ] . __proto__ === Array . prototype ;
17+
618test ( 'equal' , function ( t ) {
719 t . deepEqualTest (
820 { a : [ 2 , 3 ] , b : [ 4 ] } ,
@@ -602,20 +614,14 @@ test('getters', { skip: !Object.defineProperty }, function (t) {
602614} ) ;
603615
604616var isAssertAndNode1321 = process . env . ASSERT && process . version . replace ( / ^ v / g, '' ) . replace ( / [ ^ . ] + (?: .) ? / g, function ( x , i ) { return x * Math . pow ( 10 , i ) ; } ) <= '1320000' ;
605- // eslint-disable-next-line no-proto
606- test ( 'fake arrays: extra keys will be tested' , { skip : [ ] . __proto__ !== Array . prototype || isAssertAndNode1321 } , function ( t ) {
607- var a = {
617+ test ( 'fake arrays: extra keys will be tested' , { skip : ! hasDunderProto || isAssertAndNode1321 } , function ( t ) {
618+ var a = tag ( {
608619 __proto__ : Array . prototype ,
609620 0 : 1 ,
610621 1 : 1 ,
611622 2 : 'broken' ,
612623 length : 2
613- } ;
614- if ( hasSymbols ) {
615- Object . defineProperty ( a , Symbol . toStringTag , {
616- value : 'Array'
617- } ) ;
618- }
624+ } , 'Array' ) ;
619625 if ( Object . defineProperty ) {
620626 Object . defineProperty ( a , 'length' , {
621627 enumerable : false
0 commit comments