@@ -3,6 +3,18 @@ require('./_tape');
3
3
var assign = require ( 'object.assign' ) ;
4
4
var hasSymbols = require ( 'has-symbols' ) ( ) ;
5
5
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
+
6
18
test ( 'equal' , function ( t ) {
7
19
t . deepEqualTest (
8
20
{ a : [ 2 , 3 ] , b : [ 4 ] } ,
@@ -602,20 +614,14 @@ test('getters', { skip: !Object.defineProperty }, function (t) {
602
614
} ) ;
603
615
604
616
var 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 ( {
608
619
__proto__ : Array . prototype ,
609
620
0 : 1 ,
610
621
1 : 1 ,
611
622
2 : 'broken' ,
612
623
length : 2
613
- } ;
614
- if ( hasSymbols ) {
615
- Object . defineProperty ( a , Symbol . toStringTag , {
616
- value : 'Array'
617
- } ) ;
618
- }
624
+ } , 'Array' ) ;
619
625
if ( Object . defineProperty ) {
620
626
Object . defineProperty ( a , 'length' , {
621
627
enumerable : false
0 commit comments