test: add flag scenario in test-fs-write-file-sync
fs.writeFileSync takes flag param to define the file opening semantics. Add a scenario that covers flags as well. PR-URL: https://github.com/nodejs/node/pull/24766 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
d17d7bdf4e
commit
02cd7069a8
@ -96,3 +96,12 @@ function closeSync() {
|
||||
openCount--;
|
||||
return fs._closeSync.apply(fs, arguments);
|
||||
}
|
||||
|
||||
// Test writeFileSync with flags
|
||||
const file4 = path.join(tmpdir.path, 'testWriteFileSyncFlags.txt');
|
||||
|
||||
fs.writeFileSync(file4, 'hello ', { encoding: 'utf8', flag: 'a' });
|
||||
fs.writeFileSync(file4, 'world!', { encoding: 'utf8', flag: 'a' });
|
||||
|
||||
content = fs.readFileSync(file4, { encoding: 'utf8' });
|
||||
assert.strictEqual(content, 'hello world!');
|
||||
|
Loading…
x
Reference in New Issue
Block a user