diff options
author | Evan Lucas <evanlucas@me.com> | 2016-01-26 08:12:41 -0600 |
---|---|---|
committer | Evan Lucas <evanlucas@me.com> | 2016-01-30 17:53:55 -0600 |
commit | 6cbbfef994930bc47581d592124e82b58e55ac7b (patch) | |
tree | 26be4d68b357ef6fd473b04d04b4f449e8ae215e /test/parallel/test-net-internal.js | |
parent | 6ad1f7b51ce06bfe89f32ab3d2324b81293608f8 (diff) | |
download | android-node-v8-6cbbfef994930bc47581d592124e82b58e55ac7b.tar.gz android-node-v8-6cbbfef994930bc47581d592124e82b58e55ac7b.tar.bz2 android-node-v8-6cbbfef994930bc47581d592124e82b58e55ac7b.zip |
net: move isLegalPort to internal/net
isLegalPort can be used in more places than just net.js. This change
moves it to a new internal net module in preparation for using it in
the dns module.
PR-URL: https://github.com/nodejs/node/pull/4882
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'test/parallel/test-net-internal.js')
-rw-r--r-- | test/parallel/test-net-internal.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-net-internal.js b/test/parallel/test-net-internal.js new file mode 100644 index 0000000000..b59b92d0fb --- /dev/null +++ b/test/parallel/test-net-internal.js @@ -0,0 +1,15 @@ +'use strict'; + +// Flags: --expose-internals + +require('../common'); +const assert = require('assert'); +const net = require('internal/net'); + +assert.strictEqual(net.isLegalPort(''), false); +assert.strictEqual(net.isLegalPort('0'), true); +assert.strictEqual(net.isLegalPort(0), true); +assert.strictEqual(net.isLegalPort(65536), false); +assert.strictEqual(net.isLegalPort('65535'), true); +assert.strictEqual(net.isLegalPort(undefined), false); +assert.strictEqual(net.isLegalPort(null), true); |