Skip to content

Commit

Permalink
test: refactor test-dgram-oob-buffer
Browse files Browse the repository at this point in the history
* Change common.noop to common.mustNotCall() to verify callback is not
  invoked.
* Add destructuring assignment for clarity. Yeah, clarity. That's why.

PR-URL: nodejs#13443
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
Trott committed Jun 7, 2017
1 parent d6260a8 commit 6b07065
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/parallel/test-dgram-oob-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ const socket = dgram.createSocket('udp4');
const buf = Buffer.from([1, 2, 3, 4]);
const portGetter = dgram.createSocket('udp4')
.bind(0, 'localhost', common.mustCall(() => {
const address = portGetter.address();
const { address, port } = portGetter.address();
portGetter.close(common.mustCall(() => {
socket.send(buf, 0, 0, address.port, address.address, common.noop);
socket.send(buf, 0, 4, address.port, address.address, common.noop);
socket.send(buf, 1, 3, address.port, address.address, common.noop);
socket.send(buf, 3, 1, address.port, address.address, common.noop);
socket.send(buf, 0, 0, port, address, common.mustNotCall());
socket.send(buf, 0, 4, port, address, common.mustNotCall());
socket.send(buf, 1, 3, port, address, common.mustNotCall());
socket.send(buf, 3, 1, port, address, common.mustNotCall());
// Since length of zero means nothing, don't error despite OOB.
socket.send(buf, 4, 0, address.port, address.address, common.noop);
socket.send(buf, 4, 0, port, address, common.mustNotCall());

socket.close();
}));
Expand Down

0 comments on commit 6b07065

Please sign in to comment.