Browse Source

test: increase setMulticastLoopback() coverage

PR-URL: https://github.com/nodejs/node/pull/11277
Reviewed-By: James M Snell <jasnell@gmail.com>
v4.x
cjihrig 8 years ago
committed by Myles Borins
parent
commit
f854d8c789
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 27
      test/parallel/test-dgram-multicast-loopback.js

27
test/parallel/test-dgram-multicast-loopback.js

@ -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); const socket = dgram.createSocket('udp4');
socket.on('listening', common.mustCall(() => {
const result = socket.setMulticastLoopback(16); assert.throws(() => {
assert.strictEqual(result, 16); socket.setMulticastLoopback(16);
socket.close(); }, /^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…
Cancel
Save