You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
907 B

'use strict';
const common = require('../common');
const net = require('net');
common.refreshTmpDir();
function closeServer() {
return common.mustCall(function() {
this.close();
});
}
let counter = 0;
// Avoid conflict with listen-handle
function randomPipePath() {
return common.PIPE + '-listen-path-' + (counter++);
}
// Test listen(path)
{
const handlePath = randomPipePath();
net.createServer()
.listen(handlePath)
.on('listening', closeServer());
}
// Test listen({path})
{
const handlePath = randomPipePath();
net.createServer()
.listen({path: handlePath})
.on('listening', closeServer());
}
// Test listen(path, cb)
{
const handlePath = randomPipePath();
net.createServer()
.listen(handlePath, closeServer());
}
// Test listen(path, cb)
{
const handlePath = randomPipePath();
net.createServer()
.listen({path: handlePath}, closeServer());
}