mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
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 assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
const socket = dgram.createSocket('udp4');
|
||||
|
||||
socket.bind(0);
|
||||
socket.on('listening', common.mustCall(() => {
|
||||
const result = socket.setMulticastLoopback(16);
|
||||
assert.strictEqual(result, 16);
|
||||
socket.close();
|
||||
}));
|
||||
{
|
||||
const socket = dgram.createSocket('udp4');
|
||||
|
||||
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();
|
||||
}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user