Browse Source

test: add coverage for string array dgram send()

This commit adds code coverage for dgram's Socket#send() where
the data is an array of strings.

PR-URL: https://github.com/nodejs/node/pull/11247
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
v6.x
cjihrig 8 years ago
committed by Myles Borins
parent
commit
baec432c93
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 13
      test/parallel/test-dgram-send-multi-string-array.js

13
test/parallel/test-dgram-send-multi-string-array.js

@ -0,0 +1,13 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const dgram = require('dgram');
const socket = dgram.createSocket('udp4');
const data = ['foo', 'bar', 'baz'];
socket.on('message', common.mustCall((msg, rinfo) => {
socket.close();
assert.deepStrictEqual(msg.toString(), data.join(''));
}));
socket.bind(() => socket.send(data, socket.address().port, 'localhost'));
Loading…
Cancel
Save