Skip to content

Commit

Permalink
test: add test for fs.promises.lchmod
Browse files Browse the repository at this point in the history
To increase test coverage for fs.promises by adding a test for
lchmod.

PR-URL: #20584
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
Masashi Hirano authored and addaleax committed May 31, 2018
1 parent 44ef458 commit ff5f20f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/parallel/test-fs-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const {
ftruncate,
futimes,
link,
lchmod,
lstat,
mkdir,
mkdtemp,
Expand Down Expand Up @@ -160,14 +161,21 @@ function verifyStatObject(stat) {
if (common.canCreateSymLink()) {
const newLink = path.resolve(tmpDir, 'baz3.js');
await symlink(newPath, newLink);

stats = await lstat(newLink);
verifyStatObject(stats);

assert.strictEqual(newPath.toLowerCase(),
(await realpath(newLink)).toLowerCase());
assert.strictEqual(newPath.toLowerCase(),
(await readlink(newLink)).toLowerCase());
if (common.isOSX) {
// lchmod is only available on macOS
const newMode = 0o666;
await lchmod(newLink, newMode);
stats = await lstat(newLink);
assert.strictEqual(stats.mode & 0o777, newMode);
}


await unlink(newLink);
}
Expand Down

0 comments on commit ff5f20f

Please sign in to comment.