aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-dgram-oob-buffer.js
diff options
context:
space:
mode:
authorMyles Borins <mborins@us.ibm.com>2015-10-20 11:40:54 -0700
committerRich Trott <rtrott@gmail.com>2015-10-24 14:42:41 -0700
commit28e9a022df3ef89a0ea21e4ad86655eb408a8d96 (patch)
treecfa007439af61736767bab8df5556c871d091468 /test/parallel/test-dgram-oob-buffer.js
parentb6207906c452be4c5f049a098fc645fdfb897306 (diff)
downloadandroid-node-v8-28e9a022df3ef89a0ea21e4ad86655eb408a8d96.tar.gz
android-node-v8-28e9a022df3ef89a0ea21e4ad86655eb408a8d96.tar.bz2
android-node-v8-28e9a022df3ef89a0ea21e4ad86655eb408a8d96.zip
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-oob-buffer.js')
-rw-r--r--test/parallel/test-dgram-oob-buffer.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/parallel/test-dgram-oob-buffer.js b/test/parallel/test-dgram-oob-buffer.js
index e873715e4e..6d0626fc2d 100644
--- a/test/parallel/test-dgram-oob-buffer.js
+++ b/test/parallel/test-dgram-oob-buffer.js
@@ -19,22 +19,22 @@ socket.send(buf, 3, 1, common.PORT, '127.0.0.1', ok);
socket.send(buf, 4, 0, common.PORT, '127.0.0.1', ok);
assert.throws(function() {
- socket.send(buf, 0, 5, common.PORT, '127.0.0.1', assert.fail);
+ socket.send(buf, 0, 5, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send(buf, 2, 3, common.PORT, '127.0.0.1', assert.fail);
+ socket.send(buf, 2, 3, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send(buf, 4, 4, common.PORT, '127.0.0.1', assert.fail);
+ socket.send(buf, 4, 4, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send('abc', 4, 1, common.PORT, '127.0.0.1', assert.fail);
+ socket.send('abc', 4, 1, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send('abc', 0, 4, common.PORT, '127.0.0.1', assert.fail);
+ socket.send('abc', 0, 4, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send('abc', -1, 2, common.PORT, '127.0.0.1', assert.fail);
+ socket.send('abc', -1, 2, common.PORT, '127.0.0.1', common.fail);
});
socket.close(); // FIXME should not be necessary