Skip to content

Commit

Permalink
test: increase specificity in dgram test
Browse files Browse the repository at this point in the history
Expand error message checking to include the entire error string in
test-dgram-membership.

PR-URL: #11187
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Mar 9, 2017
1 parent 4bb6155 commit c532c16
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-dgram-membership.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
const socket = setup();
socket.close(common.mustCall(() => {
assert.throws(() => { socket.addMembership(multicastAddress); },
/Not running/);
/^Error: Not running$/);
}));
}

Expand All @@ -21,23 +21,23 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
const socket = setup();
socket.close(common.mustCall(() => {
assert.throws(() => { socket.dropMembership(multicastAddress); },
/Not running/);
/^Error: Not running$/);
}));
}

// addMembership() with no argument should throw
{
const socket = setup();
assert.throws(() => { socket.addMembership(); },
/multicast address must be specified/);
/^Error: multicast address must be specified$/);
socket.close();
}

// dropMembership() with no argument should throw
{
const socket = setup();
assert.throws(() => { socket.dropMembership(); },
/multicast address must be specified/);
/^Error: multicast address must be specified$/);
socket.close();
}

Expand Down Expand Up @@ -69,7 +69,7 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
const socket = setup();
assert.throws(
() => { socket.dropMembership(multicastAddress); },
/EADDRNOTAVAIL/
/^Error: dropMembership EADDRNOTAVAIL$/
);
socket.close();
}
Expand Down

0 comments on commit c532c16

Please sign in to comment.