Permalink
Browse files

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: #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>
  • Loading branch information...
cjihrig authored and italoacasas committed Feb 8, 2017
1 parent 5059b6f commit e1beb9fbfc77e1590bbfba0ccc23ab4e5b8aaa8c
Showing with 13 additions and 0 deletions.
  1. +13 −0 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'));

0 comments on commit e1beb9f

Please sign in to comment.