0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-fs-realpath-native.js
Ben Noordhuis 74023c072c fs: expose realpath(3) bindings
Make the `uv_fs_realpath()` binding (which calls the libc `realpath()`
on UNIX and `GetFinalPathNameByHandle()` on Windows) available as the
`fs.realpath.native()` and `fs.realpathSync.native()` functions.

The binding was already available as `process.binding('fs').realpath`
but was not exposed or tested - and partly broken as a result.

Fixes: https://github.com/nodejs/node/issues/8715
PR-URL: https://github.com/nodejs/node/pull/15776
Refs: https://github.com/nodejs/node/pull/7899
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2017-11-09 11:39:46 +01:00

13 lines
355 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
if (!common.isOSX) common.skip('MacOS-only test.');
assert.strictEqual(fs.realpathSync.native('/users'), '/Users');
fs.realpath.native('/users', common.mustCall((err, res) => {
assert.ifError(err);
assert.strictEqual(res, '/Users');
}));