0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-dgram-multicast-loopback.js
cjihrig 93982c0a3d test: increase setMulticastLoopback() coverage
PR-URL: https://github.com/nodejs/node/pull/11277
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-13 10:12:00 -05:00

24 lines
539 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const dgram = require('dgram');
{
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();
}));
}