From a2216e14521763e702f69a9bfd046aa15a5b3f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Mon, 6 Mar 2017 10:54:38 +0000 Subject: luacheck: clean up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Asbjørn Sloth Tønnesen --- test/inet.lua | 15 ++++++++------- test/inet_set.lua | 4 +--- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/inet.lua b/test/inet.lua index 43432cc..e86c074 100644 --- a/test/inet.lua +++ b/test/inet.lua @@ -12,6 +12,7 @@ local function dontparse(...) end return test.new(function() + local ip -- parsing parse('1:2:3:4:5:6:7:8') parse('::1/33') @@ -35,10 +36,10 @@ return test.new(function() assert(tostring(parse('1:ffff:ffff:fe00::/56') * 2) == '2::/56') assert(tostring(parse('1:ffff:ffff:fe00::/56') * 2 * -2) == '1:ffff:ffff:fe00::/56') - local ip = inet('10.0.0.0/33') + ip = inet('10.0.0.0/33') assert(ip == nil) - local ip = inet('10.0.0.0/24') + ip = inet('10.0.0.0/24') assert(type(ip) == 'table') assert(#ip == 24, 'incorrect netmask') assert(tostring(ip) == '10.0.0.0/24', 'not human readable') @@ -84,14 +85,14 @@ return test.new(function() -- test inet*.network assert(inet('10.0.0.1/30'):network() == inet('10.0.0.0/30'), 'inet4.network() is broken') assert(inet('1::2/64'):network() == inet('1::/64'), 'inet6.network() is broken') - local ip = inet('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/62') + ip = inet('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/62') assert((ip/22):network() == inet('ffff:fc00::/22'), 'inet6.network() is broken') assert((ip/27):network() == inet('ffff:ffe0::/27'), 'inet6.network() is broken') --- test inet4:flip - assert(inet('10.0.0.1/24'):flip() == inet('10.0.1.1/24'), 'inet.flip() is broken') - assert(inet('10.0.0.0/24'):flip() == inet('10.0.1.0/24'), 'inet.flip() is broken') - assert(inet('10.0.0.0/24'):flip():flip() == inet('10.0.0.0/24'), 'inet.flip() is broken') + assert(inet('10.0.0.1/24'):flip() == inet('10.0.1.1/24'), 'inet4.flip() is broken') + assert(inet('10.0.0.0/24'):flip() == inet('10.0.1.0/24'), 'inet4.flip() is broken') + assert(inet('10.0.0.0/24'):flip():flip() == inet('10.0.0.0/24'), 'inet4.flip() is broken') assert(inet('10.20.30.0/24'):flip() == inet('10.20.31.0/24')) assert(inet('10.20.30.5/24'):flip() == inet('10.20.31.5/24')) assert(inet('10.20.30.5/32'):flip() == inet('10.20.30.4/32')) @@ -104,7 +105,7 @@ return test.new(function() assert(inet('::1/32'):flip() == inet('0:1::1/32')) assert(inet('::1/48'):flip() == inet('0:0:1::1/48')) for i=1,#ips do - local ip = ips[i] + ip = ips[i] for j=1,128 do local foo = ip / j local bar = foo:flip() diff --git a/test/inet_set.lua b/test/inet_set.lua index ec16d8c..4c673d5 100644 --- a/test/inet_set.lua +++ b/test/inet_set.lua @@ -2,7 +2,7 @@ local inet = require 'inet' local inet_set = require 'inet.set' local test = require 'test' -function agg_set(a, b) +local function agg_set(a, b) inet_set.aggregate(a) assert(#a == #b, 'wrong set size') for i=1,#a do @@ -13,8 +13,6 @@ end return test.new(function() - local ip = inet('10.0.0.0/24') - agg_set({ inet('10.0.0.0/24'), inet('10.0.1.0/24'), -- cgit v1.2.1