diff options
author | cjihrig <cjihrig@gmail.com> | 2017-02-08 10:15:49 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2017-02-10 12:42:20 -0500 |
commit | b471392f8c6eb8dff24439ded1e51ce6e6710157 (patch) | |
tree | 2e67d4725c27e2a0c810fd66bed4fa373b52f6a2 /test/parallel/test-dgram-unref.js | |
parent | b594b3bc34e7a8f1b8c016744488e2230210da1e (diff) | |
download | android-node-v8-b471392f8c6eb8dff24439ded1e51ce6e6710157.tar.gz android-node-v8-b471392f8c6eb8dff24439ded1e51ce6e6710157.tar.bz2 android-node-v8-b471392f8c6eb8dff24439ded1e51ce6e6710157.zip |
test: increase dgram ref()/unref() coverage
This commit completes code coverage for dgram's Socket#ref() and
Socket#unref() methods.
PR-URL: https://github.com/nodejs/node/pull/11240
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-dgram-unref.js')
-rw-r--r-- | test/parallel/test-dgram-unref.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/parallel/test-dgram-unref.js b/test/parallel/test-dgram-unref.js index 3908335f24..6fcdf5d23e 100644 --- a/test/parallel/test-dgram-unref.js +++ b/test/parallel/test-dgram-unref.js @@ -2,8 +2,18 @@ const common = require('../common'); const dgram = require('dgram'); -const s = dgram.createSocket('udp4'); -s.bind(); -s.unref(); +{ + // Test the case of unref()'ing a socket with a handle. + const s = dgram.createSocket('udp4'); + s.bind(); + s.unref(); +} + +{ + // Test the case of unref()'ing a socket with no handle. + const s = dgram.createSocket('udp4'); + + s.close(common.mustCall(() => s.unref())); +} setTimeout(common.mustNotCall(), 1000).unref(); |