1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
'use strict';
var common = require('../common');
var assert = require('assert');
var net = require('net');
function close() { this.close(); }
net.Server().listen({ port: undefined }, close);
net.Server().listen({ port: '' + common.PORT }, close);
[ 'nan',
-1,
123.456,
0x10000,
1 / 0,
-1 / 0,
'+Infinity',
'-Infinity'
].forEach(function(port) {
assert.throws(function() {
net.Server().listen({ port: port }, common.fail);
}, /"port" argument must be >= 0 and < 65536/i);
});
[null, true, false].forEach(function(port) {
assert.throws(function() {
net.Server().listen({ port: port }, common.fail);
}, /invalid listen argument/i);
});
|