diff options
author | cjihrig <cjihrig@gmail.com> | 2017-09-17 23:18:59 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2017-10-24 20:29:25 -0400 |
commit | c5e3353953bb5a332cb5125616f9115fda71b944 (patch) | |
tree | 816d8f943e69065f952536f249c797991fc17263 /test/parallel/test-dgram-multicast-set-interface.js | |
parent | a9f50842f6c3b75254ca16d42cafcd7f0949c664 (diff) | |
download | android-node-v8-c5e3353953bb5a332cb5125616f9115fda71b944.tar.gz android-node-v8-c5e3353953bb5a332cb5125616f9115fda71b944.tar.bz2 android-node-v8-c5e3353953bb5a332cb5125616f9115fda71b944.zip |
test: add missing assertion
This commit adds an assertion to an existing try...catch
statement. Unfortunately, assert.throws() cannot be used
because the operation succeeds on some platforms, throws
EINVAL on some platforms, and throws ENOPROTOOPT on
others.
PR-URL: https://github.com/nodejs/node/pull/15519
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-dgram-multicast-set-interface.js')
-rw-r--r-- | test/parallel/test-dgram-multicast-set-interface.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/parallel/test-dgram-multicast-set-interface.js b/test/parallel/test-dgram-multicast-set-interface.js index c065683f53..2900cb8973 100644 --- a/test/parallel/test-dgram-multicast-set-interface.js +++ b/test/parallel/test-dgram-multicast-set-interface.js @@ -33,11 +33,14 @@ const dgram = require('dgram'); socket.bind(0); socket.on('listening', common.mustCall(() => { // Try to set with an invalid interfaceAddress (wrong address class) + // + // This operation succeeds on some platforms, throws `EINVAL` on some + // platforms, and throws `ENOPROTOOPT` on others. This is unpleasant, but + // we should at least test for it. try { socket.setMulticastInterface('::'); - throw new Error('Not detected.'); } catch (e) { - console.error(`setMulticastInterface: wrong family error is: ${e}`); + assert(e.code === 'EINVAL' || e.code === 'ENOPROTOOPT'); } socket.close(); |