test: increase setMulticastLoopback() coverage
PR-URL: https://github.com/nodejs/node/pull/11277 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
3a1e67dcdc
commit
93982c0a3d
@ -2,11 +2,22 @@
|
|||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const dgram = require('dgram');
|
const dgram = require('dgram');
|
||||||
const socket = dgram.createSocket('udp4');
|
|
||||||
|
|
||||||
socket.bind(0);
|
{
|
||||||
socket.on('listening', common.mustCall(() => {
|
const socket = dgram.createSocket('udp4');
|
||||||
const result = socket.setMulticastLoopback(16);
|
|
||||||
assert.strictEqual(result, 16);
|
assert.throws(() => {
|
||||||
|
socket.setMulticastLoopback(16);
|
||||||
|
}, /^Error: setMulticastLoopback EBADF$/);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const socket = dgram.createSocket('udp4');
|
||||||
|
|
||||||
|
socket.bind(0);
|
||||||
|
socket.on('listening', common.mustCall(() => {
|
||||||
|
assert.strictEqual(socket.setMulticastLoopback(16), 16);
|
||||||
|
assert.strictEqual(socket.setMulticastLoopback(0), 0);
|
||||||
socket.close();
|
socket.close();
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user