Skip to content

Commit 71a3d2c

Browse files
Trottjasnell
authored andcommitted
test: refactor test-dgram-oob-buffer
* 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]>
1 parent 8efaa55 commit 71a3d2c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/parallel/test-dgram-oob-buffer.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ const socket = dgram.createSocket('udp4');
3131
const buf = Buffer.from([1, 2, 3, 4]);
3232
const portGetter = dgram.createSocket('udp4')
3333
.bind(0, 'localhost', common.mustCall(() => {
34-
const address = portGetter.address();
34+
const { address, port } = portGetter.address();
3535
portGetter.close(common.mustCall(() => {
36-
socket.send(buf, 0, 0, address.port, address.address, common.noop);
37-
socket.send(buf, 0, 4, address.port, address.address, common.noop);
38-
socket.send(buf, 1, 3, address.port, address.address, common.noop);
39-
socket.send(buf, 3, 1, address.port, address.address, common.noop);
36+
socket.send(buf, 0, 0, port, address, common.mustNotCall());
37+
socket.send(buf, 0, 4, port, address, common.mustNotCall());
38+
socket.send(buf, 1, 3, port, address, common.mustNotCall());
39+
socket.send(buf, 3, 1, port, address, common.mustNotCall());
4040
// Since length of zero means nothing, don't error despite OOB.
41-
socket.send(buf, 4, 0, address.port, address.address, common.noop);
41+
socket.send(buf, 4, 0, port, address, common.mustNotCall());
4242

4343
socket.close();
4444
}));

0 commit comments

Comments
 (0)