From e38e47b0ef3be84fc03bd6dd024fb20fc0357d9e Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 8 Feb 2017 15:47:23 -0500 Subject: [PATCH] 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 Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- test/parallel/test-dgram-send-multi-string-array.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/parallel/test-dgram-send-multi-string-array.js diff --git a/test/parallel/test-dgram-send-multi-string-array.js b/test/parallel/test-dgram-send-multi-string-array.js new file mode 100644 index 00000000000000..8d73a6d1839fcb --- /dev/null +++ b/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'));