Skip to content

Commit

Permalink
test: increase setMulticastLoopback() coverage
Browse files Browse the repository at this point in the history
PR-URL: #11277
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and jasnell committed Mar 9, 2017
1 parent 23e2a42 commit eec96ef
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions test/parallel/test-dgram-multicast-loopback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}));
}

0 comments on commit eec96ef

Please sign in to comment.