Skip to content

Commit baec432

Browse files
cjihrigMylesBorins
authored andcommitted
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>
1 parent 1cd526c commit baec432

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
constcommon=require('../common');
3+
constassert=require('assert');
4+
constdgram=require('dgram');
5+
constsocket=dgram.createSocket('udp4');
6+
constdata=['foo','bar','baz'];
7+
8+
socket.on('message',common.mustCall((msg,rinfo)=>{
9+
socket.close();
10+
assert.deepStrictEqual(msg.toString(),data.join(''));
11+
}));
12+
13+
socket.bind(()=>socket.send(data,socket.address().port,'localhost'));

0 commit comments

Comments
 (0)