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.bind's test
  • Loading branch information
hiroppy committed Jan 19, 2017
commit ac999d3b37310cde1805e0a7051a5f7795add463
10 changes: 7 additions & 3 deletions test/parallel/test-dgram-bind.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const dgram = require('dgram');

const socket = dgram.createSocket('udp4');

socket.on('listening', function() {
socket.on('listening', common.mustCall(() => {
assert.throws(() => {
socket.bind();
}, /^Error: Socket is already bound$/);

socket.close();
});
}));

const result = socket.bind(); // should not throw

Expand Down