Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e161dcf

Browse filesBrowse files
hiroppyItalo A. Casas
authored andcommitted
test: add dgram.Socket.prototype.sendto's test
Refs: https://github.com/nodejs/node/blob/09ebdf14005cc948529b3f193ad550d5dfded26a/lib/dgram.js#L234 PR-URL: #10901 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent be3e82d commit e161dcf
Copy full SHA for e161dcf

File tree

Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-dgram-sendto.js‎

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
const dgram = require('dgram');
5+
const socket = dgram.createSocket('udp4');
6+
7+
const errorMessage =
8+
/^Error: Send takes "offset" and "length" as args 2 and 3$/;
9+
10+
assert.throws(() => {
11+
socket.sendto();
12+
}, errorMessage);
13+
14+
assert.throws(() => {
15+
socket.sendto('buffer', 1, 'offset', 'port', 'address', 'cb');
16+
}, errorMessage);
17+
18+
assert.throws(() => {
19+
socket.sendto('buffer', 'offset', 1, 'port', 'address', 'cb');
20+
}, errorMessage);
21+
22+
assert.throws(() => {
23+
socket.sendto('buffer', 1, 1, 10, false, 'cb');
24+
}, /^Error: udp4 sockets must send to port, address$/);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.