test: use common.PIPE for emptyTxt path

Work-around for long paths exceeding limits for UNIX socket binds,
emptyTxt would otherwise be burried deep in the fixtures directory.

PR-URL: https://github.com/node-forward/node/pull/51
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Rod Vagg 2014-11-06 14:30:10 +10:00 committed by Ben Noordhuis
parent c3d3c8e8cd
commit 1f79e4f4b4

View File

@ -31,7 +31,18 @@ var accessErrorFired = false;
// Test if ENOTSOCK is fired when trying to connect to a file which is not
// a socket.
var emptyTxt = path.join(common.fixturesDir, 'empty.txt');
var emptyTxt = common.PIPE + '.txt';
function cleanup() {
try {
fs.unlinkSync(emptyTxt);
} catch (e) {
if (e.code != 'ENOENT')
throw e;
}
}
process.on('exit', cleanup);
cleanup();
fs.writeFileSync(emptyTxt, '');
var notSocketClient = net.createConnection(emptyTxt, function() {
assert.ok(false);
});