From f600111d82ba208ff14c1b87ab0bef6eedeff4e7 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Thu, 19 Mar 2015 09:27:26 +1100 Subject: test: cache lazy properties, fix style nits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- test/parallel/test-dgram-address.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test/parallel/test-dgram-address.js') 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'; -- cgit v1.2.3