mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

Use the common.isWindows, common.isFreeBSD and common.isSunOS where possible. Add common.isOSX and common.isLinux. Fix `test-fs-read-file-sync-hostname` as in its current form was not being run anywhere. PR-URL: https://github.com/nodejs/node/pull/7845 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
32 lines
765 B
JavaScript
32 lines
765 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
const assert = require('assert');
|
|
|
|
if (!common.isLinux) {
|
|
common.skip('Test is linux specific.');
|
|
return;
|
|
}
|
|
|
|
common.refreshTmpDir();
|
|
const filename = '\uD83D\uDC04';
|
|
const root = Buffer.from(`${common.tmpDir}${path.sep}`);
|
|
const filebuff = Buffer.from(filename, 'ucs2');
|
|
const fullpath = Buffer.concat([root, filebuff]);
|
|
|
|
fs.closeSync(fs.openSync(fullpath, 'w+'));
|
|
|
|
fs.readdir(common.tmpDir, 'ucs2', (err, list) => {
|
|
if (err) throw err;
|
|
assert.equal(1, list.length);
|
|
const fn = list[0];
|
|
assert.deepStrictEqual(filebuff, Buffer.from(fn, 'ucs2'));
|
|
assert.strictEqual(fn, filename);
|
|
});
|
|
|
|
process.on('exit', () => {
|
|
fs.unlinkSync(fullpath);
|
|
});
|