1
1
'use strict' ;
2
- var common = require ( '../common' ) ;
3
- var assert = require ( 'assert' ) ;
4
- var path = require ( 'path' ) ;
5
- var Buffer = require ( 'buffer' ) . Buffer ;
6
- var fs = require ( 'fs' ) ;
7
- var fn = path . join ( common . tmpDir , 'write.txt' ) ;
8
- var fn2 = path . join ( common . tmpDir , 'write2.txt' ) ;
9
- var expected = 'ümlaut.' ;
10
- var constants = fs . constants ;
2
+ const common = require ( '../common' ) ;
3
+ const assert = require ( 'assert' ) ;
4
+ const path = require ( 'path' ) ;
5
+ const Buffer = require ( 'buffer' ) . Buffer ;
6
+ const fs = require ( 'fs' ) ;
7
+ const fn = path . join ( common . tmpDir , 'write.txt' ) ;
8
+ const fn2 = path . join ( common . tmpDir , 'write2.txt' ) ;
9
+ const expected = 'ümlaut.' ;
10
+ const constants = fs . constants ;
11
11
12
12
common . refreshTmpDir ( ) ;
13
13
14
14
fs . open ( fn , 'w' , 0o644 , common . mustCall ( function ( err , fd ) {
15
15
if ( err ) throw err ;
16
16
console . log ( 'open done' ) ;
17
17
fs . write ( fd , '' , 0 , 'utf8' , function ( err , written ) {
18
- assert . equal ( 0 , written ) ;
18
+ assert . strictEqual ( 0 , written ) ;
19
19
} ) ;
20
20
fs . write ( fd , expected , 0 , 'utf8' , common . mustCall ( function ( err , written ) {
21
21
console . log ( 'write done' ) ;
22
22
if ( err ) throw err ;
23
- assert . equal ( Buffer . byteLength ( expected ) , written ) ;
23
+ assert . strictEqual ( Buffer . byteLength ( expected ) , written ) ;
24
24
fs . closeSync ( fd ) ;
25
25
const found = fs . readFileSync ( fn , 'utf8' ) ;
26
26
console . log ( 'expected: "%s"' , expected ) ;
@@ -36,12 +36,12 @@ fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0o644,
36
36
if ( err ) throw err ;
37
37
console . log ( 'open done' ) ;
38
38
fs . write ( fd , '' , 0 , 'utf8' , ( err , written ) => {
39
- assert . equal ( 0 , written ) ;
39
+ assert . strictEqual ( 0 , written ) ;
40
40
} ) ;
41
41
fs . write ( fd , expected , 0 , 'utf8' , common . mustCall ( ( err , written ) => {
42
42
console . log ( 'write done' ) ;
43
43
if ( err ) throw err ;
44
- assert . equal ( Buffer . byteLength ( expected ) , written ) ;
44
+ assert . strictEqual ( Buffer . byteLength ( expected ) , written ) ;
45
45
fs . closeSync ( fd ) ;
46
46
const found = fs . readFileSync ( fn2 , 'utf8' ) ;
47
47
console . log ( 'expected: "%s"' , expected ) ;
0 commit comments