@@ -32,7 +32,9 @@ assert.strictEqual(0, d.length);
3232
3333var ui32 = new Uint32Array ( 4 ) . fill ( 42 ) ;
3434var e = Buffer . from ( ui32 ) ;
35- assert . deepEqual ( ui32 , e ) ;
35+ for ( const [ index , value ] of e . entries ( ) ) {
36+ assert . strictEqual ( value , ui32 [ index ] ) ;
37+ }
3638
3739// First check Buffer#fill() works as expected.
3840
@@ -463,32 +465,32 @@ for (let i = 0; i < Buffer.byteLength(utf8String); i++) {
463465 assert . equal ( d [ 0 ] , 23 ) ;
464466 assert . equal ( d [ 1 ] , 42 ) ;
465467 assert . equal ( d [ 2 ] , 255 ) ;
466- assert . deepEqual ( d , Buffer . from ( d ) ) ;
468+ assert . deepStrictEqual ( d , Buffer . from ( d ) ) ;
467469}
468470
469471{
470472 const e = Buffer . from ( 'über' ) ;
471473 console . error ( 'uber: \'%s\'' , e . toString ( ) ) ;
472- assert . deepEqual ( e , Buffer . from ( [ 195 , 188 , 98 , 101 , 114 ] ) ) ;
474+ assert . deepStrictEqual ( e , Buffer . from ( [ 195 , 188 , 98 , 101 , 114 ] ) ) ;
473475}
474476
475477{
476478 const f = Buffer . from ( 'über' , 'ascii' ) ;
477479 console . error ( 'f.length: %d (should be 4)' , f . length ) ;
478- assert . deepEqual ( f , Buffer . from ( [ 252 , 98 , 101 , 114 ] ) ) ;
480+ assert . deepStrictEqual ( f , Buffer . from ( [ 252 , 98 , 101 , 114 ] ) ) ;
479481}
480482
481483[ 'ucs2' , 'ucs-2' , 'utf16le' , 'utf-16le' ] . forEach ( function ( encoding ) {
482484 {
483485 const f = Buffer . from ( 'über' , encoding ) ;
484486 console . error ( 'f.length: %d (should be 8)' , f . length ) ;
485- assert . deepEqual ( f , Buffer . from ( [ 252 , 0 , 98 , 0 , 101 , 0 , 114 , 0 ] ) ) ;
487+ assert . deepStrictEqual ( f , Buffer . from ( [ 252 , 0 , 98 , 0 , 101 , 0 , 114 , 0 ] ) ) ;
486488 }
487489
488490 {
489491 const f = Buffer . from ( 'привет' , encoding ) ;
490492 console . error ( 'f.length: %d (should be 12)' , f . length ) ;
491- assert . deepEqual ( f ,
493+ assert . deepStrictEqual ( f ,
492494 Buffer . from ( [ 63 , 4 , 64 , 4 , 56 , 4 , 50 , 4 , 53 , 4 , 66 , 4 ] ) ) ;
493495 assert . equal ( f . toString ( encoding ) , 'привет' ) ;
494496 }
@@ -499,23 +501,23 @@ for (let i = 0; i < Buffer.byteLength(utf8String); i++) {
499501 const size = f . write ( 'あいうえお' , encoding ) ;
500502 console . error ( 'bytes written to buffer: %d (should be 4)' , size ) ;
501503 assert . equal ( size , 4 ) ;
502- assert . deepEqual ( f , Buffer . from ( [ 0x42 , 0x30 , 0x44 , 0x30 , 0x00 ] ) ) ;
504+ assert . deepStrictEqual ( f , Buffer . from ( [ 0x42 , 0x30 , 0x44 , 0x30 , 0x00 ] ) ) ;
503505 }
504506} ) ;
505507
506508{
507509 const f = Buffer . from ( '\uD83D\uDC4D' , 'utf-16le' ) ; // THUMBS UP SIGN (U+1F44D)
508510 assert . equal ( f . length , 4 ) ;
509- assert . deepEqual ( f , Buffer . from ( '3DD84DDC' , 'hex' ) ) ;
511+ assert . deepStrictEqual ( f , Buffer . from ( '3DD84DDC' , 'hex' ) ) ;
510512}
511513
512514
513515var arrayIsh = { 0 : 0 , 1 : 1 , 2 : 2 , 3 : 3 , length : 4 } ;
514516var g = Buffer . from ( arrayIsh ) ;
515- assert . deepEqual ( g , Buffer . from ( [ 0 , 1 , 2 , 3 ] ) ) ;
517+ assert . deepStrictEqual ( g , Buffer . from ( [ 0 , 1 , 2 , 3 ] ) ) ;
516518var strArrayIsh = { 0 : '0' , 1 : '1' , 2 : '2' , 3 : '3' , length : 4 } ;
517519g = Buffer . from ( strArrayIsh ) ;
518- assert . deepEqual ( g , Buffer . from ( [ 0 , 1 , 2 , 3 ] ) ) ;
520+ assert . deepStrictEqual ( g , Buffer . from ( [ 0 , 1 , 2 , 3 ] ) ) ;
519521
520522
521523//
@@ -526,10 +528,10 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
526528{
527529 // test that regular and URL-safe base64 both work
528530 const expected = [ 0xff , 0xff , 0xbe , 0xff , 0xef , 0xbf , 0xfb , 0xef , 0xff ] ;
529- assert . deepEqual ( Buffer . from ( '//++/++/++//' , 'base64' ) ,
530- Buffer . from ( expected ) ) ;
531- assert . deepEqual ( Buffer . from ( '__--_--_--__' , 'base64' ) ,
532- Buffer . from ( expected ) ) ;
531+ assert . deepStrictEqual ( Buffer . from ( '//++/++/++//' , 'base64' ) ,
532+ Buffer . from ( expected ) ) ;
533+ assert . deepStrictEqual ( Buffer . from ( '__--_--_--__' , 'base64' ) ,
534+ Buffer . from ( expected ) ) ;
533535}
534536
535537{
@@ -1021,7 +1023,7 @@ Buffer.from(Buffer.allocUnsafe(0), 0, 0);
10211023
10221024 assert . equal ( string , '{"type":"Buffer","data":[116,101,115,116]}' ) ;
10231025
1024- assert . deepEqual ( buffer , JSON . parse ( string , function ( key , value ) {
1026+ assert . deepStrictEqual ( buffer , JSON . parse ( string , function ( key , value ) {
10251027 return value && value . type === 'Buffer'
10261028 ? Buffer . from ( value . data )
10271029 : value ;
@@ -1167,92 +1169,92 @@ assert.throws(function() {
11671169( function ( ) {
11681170 var buf = Buffer . allocUnsafe ( 3 ) ;
11691171 buf . writeUIntLE ( 0x123456 , 0 , 3 ) ;
1170- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x56 , 0x34 , 0x12 ] ) ;
1172+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x56 , 0x34 , 0x12 ] ) ;
11711173 assert . equal ( buf . readUIntLE ( 0 , 3 ) , 0x123456 ) ;
11721174
11731175 buf = Buffer . allocUnsafe ( 3 ) ;
11741176 buf . writeUIntBE ( 0x123456 , 0 , 3 ) ;
1175- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x12 , 0x34 , 0x56 ] ) ;
1177+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x12 , 0x34 , 0x56 ] ) ;
11761178 assert . equal ( buf . readUIntBE ( 0 , 3 ) , 0x123456 ) ;
11771179
11781180 buf = Buffer . allocUnsafe ( 3 ) ;
11791181 buf . writeIntLE ( 0x123456 , 0 , 3 ) ;
1180- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x56 , 0x34 , 0x12 ] ) ;
1182+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x56 , 0x34 , 0x12 ] ) ;
11811183 assert . equal ( buf . readIntLE ( 0 , 3 ) , 0x123456 ) ;
11821184
11831185 buf = Buffer . allocUnsafe ( 3 ) ;
11841186 buf . writeIntBE ( 0x123456 , 0 , 3 ) ;
1185- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x12 , 0x34 , 0x56 ] ) ;
1187+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x12 , 0x34 , 0x56 ] ) ;
11861188 assert . equal ( buf . readIntBE ( 0 , 3 ) , 0x123456 ) ;
11871189
11881190 buf = Buffer . allocUnsafe ( 3 ) ;
11891191 buf . writeIntLE ( - 0x123456 , 0 , 3 ) ;
1190- assert . deepEqual ( buf . toJSON ( ) . data , [ 0xaa , 0xcb , 0xed ] ) ;
1192+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0xaa , 0xcb , 0xed ] ) ;
11911193 assert . equal ( buf . readIntLE ( 0 , 3 ) , - 0x123456 ) ;
11921194
11931195 buf = Buffer . allocUnsafe ( 3 ) ;
11941196 buf . writeIntBE ( - 0x123456 , 0 , 3 ) ;
1195- assert . deepEqual ( buf . toJSON ( ) . data , [ 0xed , 0xcb , 0xaa ] ) ;
1197+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0xed , 0xcb , 0xaa ] ) ;
11961198 assert . equal ( buf . readIntBE ( 0 , 3 ) , - 0x123456 ) ;
11971199
11981200 buf = Buffer . allocUnsafe ( 3 ) ;
11991201 buf . writeIntLE ( - 0x123400 , 0 , 3 ) ;
1200- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x00 , 0xcc , 0xed ] ) ;
1202+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x00 , 0xcc , 0xed ] ) ;
12011203 assert . equal ( buf . readIntLE ( 0 , 3 ) , - 0x123400 ) ;
12021204
12031205 buf = Buffer . allocUnsafe ( 3 ) ;
12041206 buf . writeIntBE ( - 0x123400 , 0 , 3 ) ;
1205- assert . deepEqual ( buf . toJSON ( ) . data , [ 0xed , 0xcc , 0x00 ] ) ;
1207+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0xed , 0xcc , 0x00 ] ) ;
12061208 assert . equal ( buf . readIntBE ( 0 , 3 ) , - 0x123400 ) ;
12071209
12081210 buf = Buffer . allocUnsafe ( 3 ) ;
12091211 buf . writeIntLE ( - 0x120000 , 0 , 3 ) ;
1210- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x00 , 0x00 , 0xee ] ) ;
1212+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x00 , 0x00 , 0xee ] ) ;
12111213 assert . equal ( buf . readIntLE ( 0 , 3 ) , - 0x120000 ) ;
12121214
12131215 buf = Buffer . allocUnsafe ( 3 ) ;
12141216 buf . writeIntBE ( - 0x120000 , 0 , 3 ) ;
1215- assert . deepEqual ( buf . toJSON ( ) . data , [ 0xee , 0x00 , 0x00 ] ) ;
1217+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0xee , 0x00 , 0x00 ] ) ;
12161218 assert . equal ( buf . readIntBE ( 0 , 3 ) , - 0x120000 ) ;
12171219
12181220 buf = Buffer . allocUnsafe ( 5 ) ;
12191221 buf . writeUIntLE ( 0x1234567890 , 0 , 5 ) ;
1220- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x90 , 0x78 , 0x56 , 0x34 , 0x12 ] ) ;
1222+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x90 , 0x78 , 0x56 , 0x34 , 0x12 ] ) ;
12211223 assert . equal ( buf . readUIntLE ( 0 , 5 ) , 0x1234567890 ) ;
12221224
12231225 buf = Buffer . allocUnsafe ( 5 ) ;
12241226 buf . writeUIntBE ( 0x1234567890 , 0 , 5 ) ;
1225- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x12 , 0x34 , 0x56 , 0x78 , 0x90 ] ) ;
1227+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x12 , 0x34 , 0x56 , 0x78 , 0x90 ] ) ;
12261228 assert . equal ( buf . readUIntBE ( 0 , 5 ) , 0x1234567890 ) ;
12271229
12281230 buf = Buffer . allocUnsafe ( 5 ) ;
12291231 buf . writeIntLE ( 0x1234567890 , 0 , 5 ) ;
1230- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x90 , 0x78 , 0x56 , 0x34 , 0x12 ] ) ;
1232+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x90 , 0x78 , 0x56 , 0x34 , 0x12 ] ) ;
12311233 assert . equal ( buf . readIntLE ( 0 , 5 ) , 0x1234567890 ) ;
12321234
12331235 buf = Buffer . allocUnsafe ( 5 ) ;
12341236 buf . writeIntBE ( 0x1234567890 , 0 , 5 ) ;
1235- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x12 , 0x34 , 0x56 , 0x78 , 0x90 ] ) ;
1237+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x12 , 0x34 , 0x56 , 0x78 , 0x90 ] ) ;
12361238 assert . equal ( buf . readIntBE ( 0 , 5 ) , 0x1234567890 ) ;
12371239
12381240 buf = Buffer . allocUnsafe ( 5 ) ;
12391241 buf . writeIntLE ( - 0x1234567890 , 0 , 5 ) ;
1240- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x70 , 0x87 , 0xa9 , 0xcb , 0xed ] ) ;
1242+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x70 , 0x87 , 0xa9 , 0xcb , 0xed ] ) ;
12411243 assert . equal ( buf . readIntLE ( 0 , 5 ) , - 0x1234567890 ) ;
12421244
12431245 buf = Buffer . allocUnsafe ( 5 ) ;
12441246 buf . writeIntBE ( - 0x1234567890 , 0 , 5 ) ;
1245- assert . deepEqual ( buf . toJSON ( ) . data , [ 0xed , 0xcb , 0xa9 , 0x87 , 0x70 ] ) ;
1247+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0xed , 0xcb , 0xa9 , 0x87 , 0x70 ] ) ;
12461248 assert . equal ( buf . readIntBE ( 0 , 5 ) , - 0x1234567890 ) ;
12471249
12481250 buf = Buffer . allocUnsafe ( 5 ) ;
12491251 buf . writeIntLE ( - 0x0012000000 , 0 , 5 ) ;
1250- assert . deepEqual ( buf . toJSON ( ) . data , [ 0x00 , 0x00 , 0x00 , 0xee , 0xff ] ) ;
1252+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0x00 , 0x00 , 0x00 , 0xee , 0xff ] ) ;
12511253 assert . equal ( buf . readIntLE ( 0 , 5 ) , - 0x0012000000 ) ;
12521254
12531255 buf = Buffer . allocUnsafe ( 5 ) ;
12541256 buf . writeIntBE ( - 0x0012000000 , 0 , 5 ) ;
1255- assert . deepEqual ( buf . toJSON ( ) . data , [ 0xff , 0xee , 0x00 , 0x00 , 0x00 ] ) ;
1257+ assert . deepStrictEqual ( buf . toJSON ( ) . data , [ 0xff , 0xee , 0x00 , 0x00 , 0x00 ] ) ;
12561258 assert . equal ( buf . readIntBE ( 0 , 5 ) , - 0x0012000000 ) ;
12571259} ) ( ) ;
12581260
@@ -1292,7 +1294,7 @@ assert.throws(function() {
12921294 }
12931295
12941296 var utf16Buf = Buffer . from ( '0123456789' , 'utf16le' ) ;
1295- assert . deepEqual ( utf16Buf . slice ( 0 , 6 ) , Buffer . from ( '012' , 'utf16le' ) ) ;
1297+ assert . deepStrictEqual ( utf16Buf . slice ( 0 , 6 ) , Buffer . from ( '012' , 'utf16le' ) ) ;
12961298
12971299 assert . equal ( buf . slice ( '0' , '1' ) , '0' ) ;
12981300 assert . equal ( buf . slice ( '-5' , '10' ) , '56789' ) ;
0 commit comments