summaryrefslogtreecommitdiff
path: root/test/parallel/test-dgram-address.js
diff options
context:
space:
mode:
authorRod Vagg <rod@vagg.org>2015-03-19 09:27:26 +1100
committerRod Vagg <rod@vagg.org>2015-03-19 16:27:45 +1100
commitf600111d82ba208ff14c1b87ab0bef6eedeff4e7 (patch)
treee294184a73abfc0e944b24c9dd6f059a0a427c4b /test/parallel/test-dgram-address.js
parent3038b8ee6ac6d07cbec678c4f4ee29ae7b9f60ff (diff)
downloadandroid-node-v8-f600111d82ba208ff14c1b87ab0bef6eedeff4e7.tar.gz
android-node-v8-f600111d82ba208ff14c1b87ab0bef6eedeff4e7.tar.bz2
android-node-v8-f600111d82ba208ff14c1b87ab0bef6eedeff4e7.zip
test: cache lazy properties, fix style nits
inFreeBSDJail involves an execSync() and is used by localhost_ipv4 so will be unnecessarily expensive, so cache both values and reuse rather than re-evaluate each time. Renamed localhost_ipv4 to localhostIPv4 for style consistency. PR-URL: https://github.com/iojs/io.js/pull/1196 Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Diffstat (limited to 'test/parallel/test-dgram-address.js')
-rw-r--r--test/parallel/test-dgram-address.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/parallel/test-dgram-address.js b/test/parallel/test-dgram-address.js
index d0781a9452..6da1c6cda4 100644
--- a/test/parallel/test-dgram-address.js
+++ b/test/parallel/test-dgram-address.js
@@ -3,13 +3,12 @@ var assert = require('assert');
var dgram = require('dgram');
// IPv4 Test
-var localhost_ipv4 = common.localhost_ipv4;
var socket_ipv4 = dgram.createSocket('udp4');
var family_ipv4 = 'IPv4';
socket_ipv4.on('listening', function() {
var address_ipv4 = socket_ipv4.address();
- assert.strictEqual(address_ipv4.address, localhost_ipv4);
+ assert.strictEqual(address_ipv4.address, common.localhostIPv4);
assert.strictEqual(address_ipv4.port, common.PORT);
assert.strictEqual(address_ipv4.family, family_ipv4);
socket_ipv4.close();
@@ -20,7 +19,7 @@ socket_ipv4.on('error', function(e) {
socket_ipv4.close();
});
-socket_ipv4.bind(common.PORT, localhost_ipv4);
+socket_ipv4.bind(common.PORT, common.localhostIPv4);
// IPv6 Test
var localhost_ipv6 = '::1';