Skip to content

Commit

Permalink
test: add flag scenario in test-fs-write-file-sync
Browse files Browse the repository at this point in the history
fs.writeFileSync takes flag param to define the file opening
semantics. Add a scenario that covers flags as well.

PR-URL: #24766
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
gireeshpunathil authored and BridgeAR committed Dec 5, 2018
1 parent 7c70b61 commit 9572008
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/parallel/test-fs-write-file-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!');

0 comments on commit 9572008

Please sign in to comment.