diff options
author | Myles Borins <mborins@us.ibm.com> | 2015-10-20 11:40:54 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2015-10-24 14:42:41 -0700 |
commit | 28e9a022df3ef89a0ea21e4ad86655eb408a8d96 (patch) | |
tree | cfa007439af61736767bab8df5556c871d091468 /test/parallel/test-dgram-error-message-address.js | |
parent | b6207906c452be4c5f049a098fc645fdfb897306 (diff) | |
download | node-new-28e9a022df3ef89a0ea21e4ad86655eb408a8d96.tar.gz |
test: wrap assert.fail when passed to callback
Currently there are many instances where assert.fail is directly passed
to a callback for error handling. Unfortunately this will swallow the
error as it is the third argument of assert.fail that sets the message
not the first.
This commit adds a new function to test/common.js that simply wraps
assert.fail and calls it with the provided message.
Tip of the hat to @trott for pointing me in the direction of this.
PR-URL: https://github.com/nodejs/node/pull/3453
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-dgram-error-message-address.js')
-rw-r--r-- | test/parallel/test-dgram-error-message-address.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/parallel/test-dgram-error-message-address.js b/test/parallel/test-dgram-error-message-address.js index eca2ccce4f..e307a23e24 100644 --- a/test/parallel/test-dgram-error-message-address.js +++ b/test/parallel/test-dgram-error-message-address.js @@ -6,7 +6,7 @@ var dgram = require('dgram'); // IPv4 Test var socket_ipv4 = dgram.createSocket('udp4'); -socket_ipv4.on('listening', assert.fail); +socket_ipv4.on('listening', common.fail); socket_ipv4.on('error', common.mustCall(function(e) { assert.equal(e.message, 'bind EADDRNOTAVAIL 1.1.1.1:' + common.PORT); @@ -22,7 +22,7 @@ socket_ipv4.bind(common.PORT, '1.1.1.1'); var socket_ipv6 = dgram.createSocket('udp6'); var family_ipv6 = 'IPv6'; -socket_ipv6.on('listening', assert.fail); +socket_ipv6.on('listening', common.fail); socket_ipv6.on('error', common.mustCall(function(e) { // EAFNOSUPPORT or EPROTONOSUPPORT means IPv6 is disabled on this system. |