diff options
author | Ujjwal Sharma <usharma1998@gmail.com> | 2018-03-21 01:02:49 +0530 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-03-24 12:40:12 -0700 |
commit | eeb57022e6bada13955a19b15232a9ee4fe9b465 (patch) | |
tree | 26b1e0e74ad65e01743ce6da51934929bb3de91b /test/parallel/test-dgram-send-invalid-msg-type.js | |
parent | ca22c96f1607f5f561e4a1a091bbd494a038ec6a (diff) | |
download | android-node-v8-eeb57022e6bada13955a19b15232a9ee4fe9b465.tar.gz android-node-v8-eeb57022e6bada13955a19b15232a9ee4fe9b465.tar.bz2 android-node-v8-eeb57022e6bada13955a19b15232a9ee4fe9b465.zip |
test: rename regression tests more expressively
PR-URL: https://github.com/nodejs/node/pull/19495
Refs: https://github.com/nodejs/node/issues/19105
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-dgram-send-invalid-msg-type.js')
-rw-r--r-- | test/parallel/test-dgram-send-invalid-msg-type.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/parallel/test-dgram-send-invalid-msg-type.js b/test/parallel/test-dgram-send-invalid-msg-type.js new file mode 100644 index 0000000000..7a85455ce9 --- /dev/null +++ b/test/parallel/test-dgram-send-invalid-msg-type.js @@ -0,0 +1,36 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; +require('../common'); + +// This test ensures that a TypeError is raised when the argument to `send()` +// or `sendto()` is anything but a Buffer. +// https://github.com/nodejs/node-v0.x-archive/issues/4496 + +const assert = require('assert'); +const dgram = require('dgram'); + +// Should throw but not crash. +const socket = dgram.createSocket('udp4'); +assert.throws(function() { socket.send(true, 0, 1, 1, 'host'); }, TypeError); +assert.throws(function() { socket.sendto(5, 0, 1, 1, 'host'); }, TypeError); +socket.close(); |