24
24
require ( '../common' ) ;
25
25
const assert = require ( 'assert' ) ;
26
26
27
- assert . strictEqual ( 0 , Buffer . from ( 'hello' , 'utf8' ) . slice ( 0 , 0 ) . length ) ;
28
- assert . strictEqual ( 0 , Buffer ( 'hello' , 'utf8' ) . slice ( 0 , 0 ) . length ) ;
27
+ assert . strictEqual ( Buffer . from ( 'hello' , 'utf8' ) . slice ( 0 , 0 ) . length , 0 ) ;
28
+ assert . strictEqual ( Buffer ( 'hello' , 'utf8' ) . slice ( 0 , 0 ) . length , 0 ) ;
29
29
30
30
const buf = Buffer . from ( '0123456789' , 'utf8' ) ;
31
31
const expectedSameBufs = [
@@ -72,7 +72,7 @@ for (let i = 0, s = buf.toString(); i < buf.length; ++i) {
72
72
}
73
73
74
74
expectedSameBufs . forEach ( ( [ buf1 , buf2 ] ) => {
75
- assert . strictEqual ( 0 , Buffer . compare ( buf1 , buf2 ) ) ;
75
+ assert . strictEqual ( Buffer . compare ( buf1 , buf2 ) , 0 ) ;
76
76
} ) ;
77
77
78
78
const utf16Buf = Buffer . from ( '0123456789' , 'utf16le' ) ;
@@ -83,12 +83,12 @@ assert.strictEqual(Buffer.alloc(0).slice(0, 1).length, 0);
83
83
84
84
{
85
85
// Single argument slice
86
- assert . strictEqual ( 'bcde' ,
87
- Buffer . from ( 'abcde' , 'utf8' ) . slice ( 1 ) . toString ( 'utf8' ) ) ;
86
+ assert . strictEqual ( Buffer . from ( 'abcde' , 'utf8' ) . slice ( 1 ) . toString ( 'utf8' ) ,
87
+ 'bcde' ) ;
88
88
}
89
89
90
90
// slice(0,0).length === 0
91
- assert . strictEqual ( 0 , Buffer . from ( 'hello' , 'utf8' ) . slice ( 0 , 0 ) . length ) ;
91
+ assert . strictEqual ( Buffer . from ( 'hello' , 'utf8' ) . slice ( 0 , 0 ) . length , 0 ) ;
92
92
93
93
{
94
94
// Regression tests for https://github.com/nodejs/node/issues/9096
0 commit comments