@@ -9,7 +9,7 @@ const filepath = path.join(common.tmpDir, 'write_pos.txt');
99
1010
1111const cb_expected = 'write open close write open close write open close ' ;
12- var cb_occurred = '' ;
12+ let cb_occurred = '' ;
1313
1414const fileDataInitial = 'abcdefghijklmnopqrstuvwxyz' ;
1515
@@ -34,10 +34,8 @@ common.refreshTmpDir();
3434
3535
3636function run_test_1 ( ) {
37- var file , buffer , options ;
38-
39- options = { } ;
40- file = fs . createWriteStream ( filepath , options ) ;
37+ const options = { } ;
38+ const file = fs . createWriteStream ( filepath , options ) ;
4139 console . log ( ' (debug: start ' , file . start ) ;
4240 console . log ( ' (debug: pos ' , file . pos ) ;
4341
@@ -51,10 +49,10 @@ function run_test_1() {
5149 console . log ( ' (debug: start ' , file . start ) ;
5250 console . log ( ' (debug: pos ' , file . pos ) ;
5351 assert . strictEqual ( file . bytesWritten , buffer . length ) ;
54- var fileData = fs . readFileSync ( filepath , 'utf8' ) ;
52+ const fileData = fs . readFileSync ( filepath , 'utf8' ) ;
5553 console . log ( ' (debug: file data ' , fileData ) ;
5654 console . log ( ' (debug: expected ' , fileDataExpected_1 ) ;
57- assert . equal ( fileData , fileDataExpected_1 ) ;
55+ assert . strictEqual ( fileData , fileDataExpected_1 ) ;
5856
5957 run_test_2 ( ) ;
6058 } ) ;
@@ -65,7 +63,7 @@ function run_test_1() {
6563 throw err ;
6664 } ) ;
6765
68- buffer = new Buffer ( fileDataInitial ) ;
66+ const buffer = Buffer . from ( fileDataInitial ) ;
6967 file . write ( buffer ) ;
7068 cb_occurred += 'write ' ;
7169
@@ -74,13 +72,12 @@ function run_test_1() {
7472
7573
7674function run_test_2 ( ) {
77- var file , buffer , options ;
7875
79- buffer = new Buffer ( '123456' ) ;
76+ const buffer = Buffer . from ( '123456' ) ;
8077
81- options = { start : 10 ,
82- flags : 'r+' } ;
83- file = fs . createWriteStream ( filepath , options ) ;
78+ const options = { start : 10 ,
79+ flags : 'r+' } ;
80+ const file = fs . createWriteStream ( filepath , options ) ;
8481 console . log ( ' (debug: start ' , file . start ) ;
8582 console . log ( ' (debug: pos ' , file . pos ) ;
8683
@@ -94,10 +91,10 @@ function run_test_2() {
9491 console . log ( ' (debug: start ' , file . start ) ;
9592 console . log ( ' (debug: pos ' , file . pos ) ;
9693 assert . strictEqual ( file . bytesWritten , buffer . length ) ;
97- var fileData = fs . readFileSync ( filepath , 'utf8' ) ;
94+ const fileData = fs . readFileSync ( filepath , 'utf8' ) ;
9895 console . log ( ' (debug: file data ' , fileData ) ;
9996 console . log ( ' (debug: expected ' , fileDataExpected_2 ) ;
100- assert . equal ( fileData , fileDataExpected_2 ) ;
97+ assert . strictEqual ( fileData , fileDataExpected_2 ) ;
10198
10299 run_test_3 ( ) ;
103100 } ) ;
@@ -116,13 +113,12 @@ function run_test_2() {
116113
117114
118115function run_test_3 ( ) {
119- var file , options ;
120116
121117 const data = '\u2026\u2026' ; // 3 bytes * 2 = 6 bytes in UTF-8
122118
123- options = { start : 10 ,
124- flags : 'r+' } ;
125- file = fs . createWriteStream ( filepath , options ) ;
119+ const options = { start : 10 ,
120+ flags : 'r+' } ;
121+ const file = fs . createWriteStream ( filepath , options ) ;
126122 console . log ( ' (debug: start ' , file . start ) ;
127123 console . log ( ' (debug: pos ' , file . pos ) ;
128124
@@ -139,7 +135,7 @@ function run_test_3() {
139135 const fileData = fs . readFileSync ( filepath , 'utf8' ) ;
140136 console . log ( ' (debug: file data ' , fileData ) ;
141137 console . log ( ' (debug: expected ' , fileDataExpected_3 ) ;
142- assert . equal ( fileData , fileDataExpected_3 ) ;
138+ assert . strictEqual ( fileData , fileDataExpected_3 ) ;
143139
144140 run_test_4 ( ) ;
145141 } ) ;
0 commit comments