@@ -34,18 +34,22 @@ assert.throws(() => assert.deepStrictEqual(arr, buf),
34
34
re `${ arr } deepStrictEqual ${ buf } ` ) ;
35
35
assert . doesNotThrow ( ( ) => assert . deepEqual ( arr , buf ) ) ;
36
36
37
- const buf2 = Buffer . from ( arr ) ;
38
- buf2 . prop = 1 ;
37
+ {
38
+ const buf2 = Buffer . from ( arr ) ;
39
+ buf2 . prop = 1 ;
39
40
40
- assert . throws ( ( ) => assert . deepStrictEqual ( buf2 , buf ) ,
41
- re `${ buf2 } deepStrictEqual ${ buf } ` ) ;
42
- assert . doesNotThrow ( ( ) => assert . deepEqual ( buf2 , buf ) ) ;
41
+ assert . throws ( ( ) => assert . deepStrictEqual ( buf2 , buf ) ,
42
+ re `${ buf2 } deepStrictEqual ${ buf } ` ) ;
43
+ assert . doesNotThrow ( ( ) => assert . deepEqual ( buf2 , buf ) ) ;
44
+ }
43
45
44
- const arr2 = new Uint8Array ( [ 120 , 121 , 122 , 10 ] ) ;
45
- arr2 . prop = 5 ;
46
- assert . throws ( ( ) => assert . deepStrictEqual ( arr , arr2 ) ,
47
- re `${ arr } deepStrictEqual ${ arr2 } ` ) ;
48
- assert . doesNotThrow ( ( ) => assert . deepEqual ( arr , arr2 ) ) ;
46
+ {
47
+ const arr2 = new Uint8Array ( [ 120 , 121 , 122 , 10 ] ) ;
48
+ arr2 . prop = 5 ;
49
+ assert . throws ( ( ) => assert . deepStrictEqual ( arr , arr2 ) ,
50
+ re `${ arr } deepStrictEqual ${ arr2 } ` ) ;
51
+ assert . doesNotThrow ( ( ) => assert . deepEqual ( arr , arr2 ) ) ;
52
+ }
49
53
50
54
const date = new Date ( '2016' ) ;
51
55
@@ -85,31 +89,33 @@ assert.throws(() => assert.deepStrictEqual(re1, re2),
85
89
86
90
// For these weird cases, deepEqual should pass (at least for now),
87
91
// but deepStrictEqual should throw.
88
- const similar = new Set ( [
89
- { 0 : '1' } , // Object
90
- { 0 : 1 } , // Object
91
- new String ( '1' ) , // Object
92
- [ '1' ] , // Array
93
- [ 1 ] , // Array
94
- date2 , // Date with this[0] = '1'
95
- re2 , // RegExp with this[0] = '1'
96
- new Int8Array ( [ 1 ] ) , // Int8Array
97
- new Uint8Array ( [ 1 ] ) , // Uint8Array
98
- new Int16Array ( [ 1 ] ) , // Int16Array
99
- new Uint16Array ( [ 1 ] ) , // Uint16Array
100
- new Int32Array ( [ 1 ] ) , // Int32Array
101
- new Uint32Array ( [ 1 ] ) , // Uint32Array
102
- Buffer . from ( [ 1 ] ) ,
103
- // Arguments {'0': '1'} is not here
104
- // See https://github.com/nodejs/node-v0.x-archive/pull/7178
105
- ] ) ;
106
-
107
- for ( const a of similar ) {
108
- for ( const b of similar ) {
109
- if ( a !== b ) {
110
- assert . deepEqual ( a , b ) ;
111
- assert . throws ( ( ) => assert . deepStrictEqual ( a , b ) ,
112
- re `${ a } deepStrictEqual ${ b } ` ) ;
92
+ {
93
+ const similar = new Set ( [
94
+ { 0 : '1' } , // Object
95
+ { 0 : 1 } , // Object
96
+ new String ( '1' ) , // Object
97
+ [ '1' ] , // Array
98
+ [ 1 ] , // Array
99
+ date2 , // Date with this[0] = '1'
100
+ re2 , // RegExp with this[0] = '1'
101
+ new Int8Array ( [ 1 ] ) , // Int8Array
102
+ new Uint8Array ( [ 1 ] ) , // Uint8Array
103
+ new Int16Array ( [ 1 ] ) , // Int16Array
104
+ new Uint16Array ( [ 1 ] ) , // Uint16Array
105
+ new Int32Array ( [ 1 ] ) , // Int32Array
106
+ new Uint32Array ( [ 1 ] ) , // Uint32Array
107
+ Buffer . from ( [ 1 ] ) ,
108
+ // Arguments {'0': '1'} is not here
109
+ // See https://github.com/nodejs/node-v0.x-archive/pull/7178
110
+ ] ) ;
111
+
112
+ for ( const a of similar ) {
113
+ for ( const b of similar ) {
114
+ if ( a !== b ) {
115
+ assert . deepEqual ( a , b ) ;
116
+ assert . throws ( ( ) => assert . deepStrictEqual ( a , b ) ,
117
+ re `${ a } deepStrictEqual ${ b } ` ) ;
118
+ }
113
119
}
114
120
}
115
121
}
0 commit comments