★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/95720089d5Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files
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: #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>
  • Loading branch information
gireeshpunathil authored and BridgeAR committed Dec 5, 2018
1 parent 7c70b61 commit 95720089d54fe5d11d4b7a9094cac1518cf3bec7
Showing with 9 additions and 0 deletions.
  1. +9 −0 test/parallel/test-fs-write-file-sync.js
@@ -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.