Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: add dgram.Socket.prototype.sendto's test
  • Loading branch information
hiroppy committed Jan 23, 2017
commit 5bacf6e10d1ff7d90c7cb7c41587b60d66f09f5e
24 changes: 24 additions & 0 deletions test/parallel/test-dgram-sendto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';
require('../common');
const assert = require('assert');
const dgram = require('dgram');
const socket = dgram.createSocket('udp4');

const errorMessage =
/^Error: Send takes "offset" and "length" as args 2 and 3$/;

assert.throws(() => {
socket.sendto();
}, errorMessage);

assert.throws(() => {
socket.sendto('buffer', 1, 'offset', 'port', 'address', 'cb');
}, errorMessage);

assert.throws(() => {
socket.sendto('buffer', 'offset', 1, 'port', 'address', 'cb');
}, errorMessage);

assert.throws(() => {
socket.sendto('buffer', 1, 1, 10, false, 'cb');
}, /^Error: udp4 sockets must send to port, address$/);