-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: check close callback is function
PR-URL: #609 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
- Loading branch information
1 parent
207e48c
commit 8c0742f
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
test/parallel/test-net-listen-close-server-callback-is-not-function.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var assert = require('assert'); | ||
var common = require('../common'); | ||
var net = require('net'); | ||
|
||
var server = net.createServer(assert.fail); | ||
var closeEvents = 0; | ||
|
||
server.on('close', function() { | ||
++closeEvents; | ||
}); | ||
|
||
server.listen(common.PORT, function() { | ||
assert(false); | ||
}); | ||
|
||
server.close('bad argument'); | ||
|
||
process.on('exit', function() { | ||
assert.equal(closeEvents, 1); | ||
}); |