@@ -33,7 +33,6 @@ const fn = path.join(tmpdir.path, 'write.txt');
33
33
const fn2 = path . join ( tmpdir . path , 'write2.txt' ) ;
34
34
const fn3 = path . join ( tmpdir . path , 'write3.txt' ) ;
35
35
const fn4 = path . join ( tmpdir . path , 'write4.txt' ) ;
36
- const fn5 = path . join ( tmpdir . path , 'write5.txt' ) ;
37
36
const expected = 'ümlaut.' ;
38
37
const constants = fs . constants ;
39
38
@@ -127,23 +126,6 @@ fs.open(fn3, 'w', 0o644, common.mustSucceed((fd) => {
127
126
} ) ) ;
128
127
129
128
130
- // Test write with an object with an own toString function
131
- // Runtime deprecated by DEP0162
132
- common . expectWarning ( 'DeprecationWarning' ,
133
- 'Implicit coercion of objects with own toString property is deprecated.' ,
134
- 'DEP0162' ) ;
135
- fs . open ( fn4 , 'w' , 0o644 , common . mustSucceed ( ( fd ) => {
136
- const done = common . mustSucceed ( ( written ) => {
137
- assert . strictEqual ( written , Buffer . byteLength ( expected ) ) ;
138
- fs . closeSync ( fd ) ;
139
- } ) ;
140
-
141
- const data = {
142
- toString ( ) { return expected ; }
143
- } ;
144
- fs . write ( fd , data , done ) ;
145
- } ) ) ;
146
-
147
129
[ false , 'test' , { } , [ ] , null , undefined ] . forEach ( ( i ) => {
148
130
assert . throws (
149
131
( ) => fs . write ( i , common . mustNotCall ( ) ) ,
@@ -162,9 +144,12 @@ fs.open(fn4, 'w', 0o644, common.mustSucceed((fd) => {
162
144
} ) ;
163
145
164
146
[
165
- false , 5 , { } , [ ] , null , undefined ,
147
+ false , 5 , { } , [ ] , null , undefined , true , 5n , ( ) => { } , Symbol ( ) , new Map ( ) ,
166
148
new String ( 'notPrimitive' ) ,
167
149
{ [ Symbol . toPrimitive ] : ( hint ) => 'amObject' } ,
150
+ { toString ( ) { return 'amObject' ; } } ,
151
+ Promise . resolve ( 'amPromise' ) ,
152
+ common . mustNotCall ( ) ,
168
153
] . forEach ( ( data ) => {
169
154
assert . throws (
170
155
( ) => fs . write ( 1 , data , common . mustNotCall ( ) ) ,
@@ -184,7 +169,7 @@ fs.open(fn4, 'w', 0o644, common.mustSucceed((fd) => {
184
169
185
170
{
186
171
// Regression test for https://github.com/nodejs/node/issues/38168
187
- const fd = fs . openSync ( fn5 , 'w' ) ;
172
+ const fd = fs . openSync ( fn4 , 'w' ) ;
188
173
189
174
assert . throws (
190
175
( ) => fs . writeSync ( fd , 'abc' , 0 , 'hex' ) ,
0 commit comments