Skip to content

Commit

Permalink
test: add coverage for string array dgram send()
Browse files Browse the repository at this point in the history
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 jasnell committed Mar 7, 2017
1 parent 8a078c8 commit 9c368b4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/parallel/test-dgram-send-multi-string-array.js
Original file line number Diff line number Diff line change
@@ -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 9c368b4

Please sign in to comment.