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: #13443
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • 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.