0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00

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>
This commit is contained in:
cjihrig 2017-02-08 15:47:23 -05:00
parent f5ee9921e6
commit df14956ca0

View File

@ -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'));