Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2a53165

Browse filesBrowse files
committed
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: #15519 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent db8c92f commit 2a53165
Copy full SHA for 2a53165

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-dgram-multicast-set-interface.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-dgram-multicast-set-interface.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ const dgram = require('dgram');
3333
socket.bind(0);
3434
socket.on('listening', common.mustCall(() => {
3535
// Try to set with an invalid interfaceAddress (wrong address class)
36+
//
37+
// This operation succeeds on some platforms, throws `EINVAL` on some
38+
// platforms, and throws `ENOPROTOOPT` on others. This is unpleasant, but
39+
// we should at least test for it.
3640
try {
3741
socket.setMulticastInterface('::');
38-
throw new Error('Not detected.');
3942
} catch (e) {
40-
console.error(`setMulticastInterface: wrong family error is: ${e}`);
43+
assert(e.code === 'EINVAL' || e.code === 'ENOPROTOOPT');
4144
}
4245

4346
socket.close();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.