test/unit: clean up according to luacheck

This commit is contained in:
Marco Hinz 2015-11-17 15:49:12 +01:00
parent 4afd386276
commit 32ecd75a16
13 changed files with 97 additions and 125 deletions

View File

@ -5,13 +5,10 @@ local helpers = require("test.unit.helpers")
local to_cstr = helpers.to_cstr
local eq = helpers.eq
local neq = helpers.neq
local NULL = helpers.NULL
local globals = helpers.cimport("./src/nvim/globals.h")
local buffer = helpers.cimport("./src/nvim/buffer.h")
local fileio = helpers.cimport("./src/nvim/fileio.h")
local ex_docmd = helpers.cimport("./src/nvim/ex_docmd.h")
local window = helpers.cimport("./src/nvim/window.h")
local option = helpers.cimport("./src/nvim/option.h")
describe('buffer functions', function()
@ -215,7 +212,7 @@ describe('buffer functions', function()
describe('build_stl_str_hl', function()
output_buffer = to_cstr(string.rep(" ", 100))
local output_buffer = to_cstr(string.rep(" ", 100))
local build_stl_str_hl = function(pat)
return buffer.build_stl_str_hl(globals.curwin,

View File

@ -4,6 +4,7 @@ local helpers = require("test.unit.helpers")
local eq = helpers.eq
local ffi = helpers.ffi
local to_cstr = helpers.to_cstr
local NULL = helpers.NULL
local fileio = helpers.cimport("./src/nvim/fileio.h")

View File

@ -124,13 +124,13 @@ end
local function set(t)
local s = {}
for i, v in ipairs(t) do
for _, v in ipairs(t) do
s[v] = true
end
return s
end
local C_keywords = set {
local C_keywords = set { -- luacheck: ignore
"break", "case", "char", "const", "continue", "default", "do", "double",
"else", "enum", "extern", "float", "for", "goto", "if", "int", "long",
"register", "return", "short", "signed", "sizeof", "static", "struct",
@ -154,13 +154,13 @@ local C_keywords = set {
-- The first one will have a lot of false positives (the line '{' for
-- example), the second one is more unique.
local function formatc(str)
local tokens = TokeniseC(str)
local toks = TokeniseC(str)
local result = {}
local block_level = 0
local allow_one_nl = false
local end_at_brace = false
for i, token in ipairs(tokens) do
for _, token in ipairs(toks) do
local typ = token[2]
if typ == '{' then
block_level = block_level + 1
@ -213,8 +213,8 @@ local function formatc(str)
end
-- standalone operation (very handy for debugging)
local function standalone(...)
Preprocess = require("preprocess")
local function standalone(...) -- luacheck: ignore
local Preprocess = require("preprocess")
Preprocess.add_to_include_path('./../../src')
Preprocess.add_to_include_path('./../../build/include')
Preprocess.add_to_include_path('./../../.deps/usr/include')

View File

@ -5,8 +5,6 @@ local internalize = helpers.internalize
local eq = helpers.eq
local neq = helpers.neq
local ffi = helpers.ffi
local lib = helpers.lib
local cstr = helpers.cstr
local to_cstr = helpers.to_cstr
local NULL = helpers.NULL
@ -48,7 +46,7 @@ local ga_size = function(garr)
return ga_len(garr) * ga_itemsize(garr)
end
local ga_maxsize = function(garr)
local ga_maxsize = function(garr) -- luacheck: ignore
return ga_maxlen(garr) * ga_itemsize(garr)
end
@ -65,8 +63,8 @@ local ga_data_as_ints = function(garr)
end
-- garray manipulation
local ga_init = function(garr, itemsize, growsize)
return garray.ga_init(garr, itemsize, growsize)
local ga_init = function(garr, itemsize_, growsize_)
return garray.ga_init(garr, itemsize_, growsize_)
end
local ga_clear = function(garr)
@ -113,7 +111,7 @@ local ga_set_len = function(garr, len)
end
local ga_inc_len = function(garr, by)
return ga_set_len(garr, ga_len(garr) + 1)
return ga_set_len(garr, ga_len(garr) + by)
end
-- custom append functions
@ -197,10 +195,9 @@ describe('garray', function()
end)
describe('ga_grow', function()
local new_and_grow
function new_and_grow(itemsize, growsize, req)
local function new_and_grow(itemsize_, growsize_, req)
local garr = new_garray()
ga_init(garr, itemsize, growsize)
ga_init(garr, itemsize_, growsize_)
eq(0, ga_size(garr)) -- should be 0 at first
eq(NULL, ga_data(garr)) -- should be NULL
ga_grow(garr, req) -- add space for `req` items
@ -306,7 +303,7 @@ describe('garray', function()
ga_init(garr, ffi.sizeof("char"), 1)
local str = "ohwell●●"
local loop = 5
for i = 1, loop do
for _ = 1, loop do
ga_concat(garr, str)
end
@ -321,7 +318,7 @@ describe('garray', function()
end)
end)
function test_concat_fn(input, fn, sep)
local function test_concat_fn(input, fn, sep)
local garr = new_string_garray()
ga_append_strings(garr, unpack(input))
if sep == nil then

View File

@ -18,17 +18,9 @@ local function trim(s)
end
-- a Set that keeps around the lines we've already seen
if cdefs == nil then
cdefs = Set:new()
end
if imported == nil then
imported = Set:new()
end
if pragma_pack_id == nil then
pragma_pack_id = 1
end
local cdefs = Set:new()
local imported = Set:new()
local pragma_pack_id = 1
-- some things are just too complex for the LuaJIT C parser to digest. We
-- usually don't need them anyway.
@ -67,7 +59,7 @@ local function cimport(...)
end
local body = nil
for i=1, 10 do
for _ = 1, 10 do
local stream = Preprocess.preprocess_stream(unpack(paths))
body = stream:read("*a")
stream:close()

View File

@ -1,11 +1,9 @@
local helpers = require('test.unit.helpers')
local cimport = helpers.cimport
local internalize = helpers.internalize
local eq = helpers.eq
local neq = helpers.neq
local ffi = helpers.ffi
local lib = helpers.lib
local cstr = helpers.cstr
local to_cstr = helpers.to_cstr
local NULL = helpers.NULL
@ -15,15 +13,15 @@ require('lfs')
local env = cimport('./src/nvim/os/os.h')
describe('env function', function()
function os_setenv(name, value, override)
local function os_setenv(name, value, override)
return env.os_setenv((to_cstr(name)), (to_cstr(value)), override)
end
function os_unsetenv(name, value, override)
local function os_unsetenv(name, _, _)
return env.os_unsetenv((to_cstr(name)))
end
function os_getenv(name)
local function os_getenv(name)
local rval = env.os_getenv((to_cstr(name)))
if rval ~= NULL then
return ffi.string(rval)

View File

@ -1,3 +1,6 @@
local lfs = require('lfs')
local bit = require('bit')
local helpers = require('test.unit.helpers')
local cimport = helpers.cimport
@ -6,16 +9,12 @@ local internalize = helpers.internalize
local eq = helpers.eq
local neq = helpers.neq
local ffi = helpers.ffi
local lib = helpers.lib
local cstr = helpers.cstr
local to_cstr = helpers.to_cstr
local OK = helpers.OK
local FAIL = helpers.FAIL
local NULL = helpers.NULL
require('lfs')
require('bit')
cimport('unistd.h')
cimport('./src/nvim/os/shell.h')
cimport('./src/nvim/option_defs.h')
@ -26,8 +25,7 @@ cppimport('sys/stat.h')
cppimport('sys/fcntl.h')
cppimport('sys/errno.h')
local len = 0
local buf = ""
local buffer = ""
local directory = nil
local absolute_executable = nil
local executable_name = nil
@ -85,24 +83,26 @@ describe('fs function', function()
end)
describe('os_dirname', function()
local length
local function os_dirname(buf, len)
return fs.os_dirname(buf, len)
end
before_each(function()
len = (string.len(lfs.currentdir())) + 1
buf = cstr(len, '')
length = (string.len(lfs.currentdir())) + 1
buffer = cstr(length, '')
end)
it('returns OK and writes current directory into the buffer if it is large\n enough', function()
eq(OK, (os_dirname(buf, len)))
eq(lfs.currentdir(), (ffi.string(buf)))
eq(OK, (os_dirname(buffer, length)))
eq(lfs.currentdir(), (ffi.string(buffer)))
end)
-- What kind of other failing cases are possible?
it('returns FAIL if the buffer is too small', function()
local buf = cstr((len - 1), '')
eq(FAIL, (os_dirname(buf, (len - 1))))
local buf = cstr((length - 1), '')
eq(FAIL, (os_dirname(buf, (length - 1))))
end)
end)
@ -213,15 +213,6 @@ describe('fs function', function()
os_setperm('unit-test-directory/test.file', orig_test_file_perm)
end)
local function os_getperm(filename)
local perm = fs.os_getperm((to_cstr(filename)))
return tonumber(perm)
end
local function os_setperm(filename, perm)
return fs.os_setperm((to_cstr(filename)), perm)
end
local function os_fchown(filename, user_id, group_id)
local fd = ffi.C.open(filename, 0)
local res = fs.os_fchown(fd, user_id, group_id)
@ -611,7 +602,7 @@ describe('fs function', function()
it('removes the given directory and returns 0', function()
lfs.mkdir('unit-test-directory/new-dir')
eq(0, (os_rmdir('unit-test-directory/new-dir', mode)))
eq(0, os_rmdir('unit-test-directory/new-dir'))
eq(false, (os_isdir('unit-test-directory/new-dir')))
end)
end)

View File

@ -17,7 +17,7 @@ local shell = helpers.cimport(
'./src/nvim/main.h',
'./src/nvim/misc1.h'
)
local ffi, eq, neq = helpers.ffi, helpers.eq, helpers.neq
local ffi, eq = helpers.ffi, helpers.eq
local intern = helpers.internalize
local to_cstr = helpers.to_cstr
local NULL = ffi.cast('void *', 0)
@ -70,7 +70,7 @@ describe('shell functions', function()
end)
it ('returns non-zero exit code', function()
local status, output = os_system('exit 2')
local status = os_system('exit 2')
eq(2, status)
end)
end)

View File

@ -1,26 +1,24 @@
local helpers = require('test.unit.helpers')
local cimport = helpers.cimport
local internalize = helpers.internalize
local eq = helpers.eq
local ffi = helpers.ffi
local lib = helpers.lib
local cstr = helpers.cstr
local NULL = helpers.NULL
local OK = helpers.OK
local FAIL = helpers.FAIL
local users = cimport('./src/nvim/os/os.h', 'unistd.h')
function garray_new()
local function garray_new()
return ffi.new('garray_T[1]')
end
function garray_get_len(array)
local function garray_get_len(array)
return array[0].ga_len
end
function garray_get_item(array, index)
local function garray_get_item(array, index)
return (ffi.cast('void **', array[0].ga_data))[index]
end

View File

@ -1,18 +1,16 @@
local lfs = require('lfs')
local helpers = require('test.unit.helpers')
local cimport = helpers.cimport
local internalize = helpers.internalize
local eq = helpers.eq
local neq = helpers.neq
local ffi = helpers.ffi
local lib = helpers.lib
local cstr = helpers.cstr
local to_cstr = helpers.to_cstr
local NULL = helpers.NULL
local OK = helpers.OK
local FAIL = helpers.FAIL
require('lfs')
cimport('string.h')
local path = cimport('./src/nvim/path.h')
@ -23,7 +21,7 @@ local kBothFilesMissing = path.kBothFilesMissing
local kOneFileMissing = path.kOneFileMissing
local kEqualFileNames = path.kEqualFileNames
local len = 0
local length = 0
local buffer = nil
describe('path function', function()
@ -36,19 +34,19 @@ describe('path function', function()
lfs.rmdir('unit-test-directory')
end)
function path_full_dir_name(directory, buffer, len)
local function path_full_dir_name(directory, buf, len)
directory = to_cstr(directory)
return path.path_full_dir_name(directory, buffer, len)
return path.path_full_dir_name(directory, buf, len)
end
before_each(function()
-- Create empty string buffer which will contain the resulting path.
len = (string.len(lfs.currentdir())) + 22
buffer = cstr(len, '')
length = string.len(lfs.currentdir()) + 22
buffer = cstr(length, '')
end)
it('returns the absolute directory name of a given relative one', function()
local result = path_full_dir_name('..', buffer, len)
local result = path_full_dir_name('..', buffer, length)
eq(OK, result)
local old_dir = lfs.currentdir()
lfs.chdir('..')
@ -58,23 +56,23 @@ describe('path function', function()
end)
it('returns the current directory name if the given string is empty', function()
eq(OK, (path_full_dir_name('', buffer, len)))
eq(OK, (path_full_dir_name('', buffer, length)))
eq(lfs.currentdir(), (ffi.string(buffer)))
end)
it('fails if the given directory does not exist', function()
eq(FAIL, path_full_dir_name('does_not_exist', buffer, len))
eq(FAIL, path_full_dir_name('does_not_exist', buffer, length))
end)
it('works with a normal relative dir', function()
local result = path_full_dir_name('unit-test-directory', buffer, len)
local result = path_full_dir_name('unit-test-directory', buffer, length)
eq(lfs.currentdir() .. '/unit-test-directory', (ffi.string(buffer)))
eq(OK, result)
end)
end)
describe('path_full_compare', function()
function path_full_compare(s1, s2, cn)
local function path_full_compare(s1, s2, cn)
s1 = to_cstr(s1)
s2 = to_cstr(s2)
return path.path_full_compare(s1, s2, cn or 0)
@ -117,7 +115,7 @@ describe('path function', function()
end)
describe('path_tail', function()
function path_tail(file)
local function path_tail(file)
local res = path.path_tail((to_cstr(file)))
neq(NULL, res)
return ffi.string(res)
@ -133,7 +131,7 @@ describe('path function', function()
end)
describe('path_tail_with_sep', function()
function path_tail_with_sep(file)
local function path_tail_with_sep(file)
local res = path.path_tail_with_sep((to_cstr(file)))
neq(NULL, res)
return ffi.string(res)
@ -165,7 +163,7 @@ describe('path function', function()
-- Returns the path tail and length (out param) of the tail.
-- Does not convert the tail from C-pointer to lua string for use with
-- strcmp.
function invocation_path_tail(invk)
local function invocation_path_tail(invk)
local plen = ffi.new('size_t[?]', 1)
local ptail = path.invocation_path_tail((to_cstr(invk)), plen)
neq(NULL, ptail)
@ -178,7 +176,7 @@ describe('path function', function()
end
-- This test mimics the intended use in C.
function compare(base, pinvk, len)
local function compare(base, pinvk, len)
return eq(0, (ffi.C.strncmp((to_cstr(base)), pinvk, len)))
end
@ -207,7 +205,7 @@ describe('path function', function()
end)
it('only accepts whitespace as a terminator for the executable name', function()
local invk, len = invocation_path_tail('exe-a+b_c[]()|#!@$%^&*')
local invk, _ = invocation_path_tail('exe-a+b_c[]()|#!@$%^&*')
eq('exe-a+b_c[]()|#!@$%^&*', (ffi.string(invk)))
end)
@ -215,20 +213,20 @@ describe('path function', function()
local ptail = path.path_tail(to_cstr("a/b/c x y z"))
neq(NULL, ptail)
local tail = ffi.string(ptail)
local invk, len = invocation_path_tail("a/b/c x y z")
local invk, _ = invocation_path_tail("a/b/c x y z")
eq(tail, ffi.string(invk))
end)
it('is not equivalent to path_tail when args contain a path separator', function()
local ptail = path.path_tail(to_cstr("a/b/c x y/z"))
neq(NULL, ptail)
local invk, len = invocation_path_tail("a/b/c x y/z")
local invk, _ = invocation_path_tail("a/b/c x y/z")
neq((ffi.string(ptail)), (ffi.string(invk)))
end)
end)
describe('path_next_component', function()
function path_next_component(file)
local function path_next_component(file)
local res = path.path_next_component((to_cstr(file)))
neq(NULL, res)
return ffi.string(res)
@ -308,11 +306,11 @@ describe('more path function', function()
-- Since the tests are executed, they are called by an executable. We use
-- that executable for several asserts.
absolute_executable = arg[0]
local absolute_executable = arg[0]
-- Split absolute_executable into a directory and the actual file name for
-- later usage.
directory, executable_name = string.match(absolute_executable, '^(.*)/(.*)$')
local directory, executable_name = string.match(absolute_executable, '^(.*)/(.*)$') -- luacheck: ignore
end)
teardown(function()
@ -321,27 +319,27 @@ describe('more path function', function()
end)
describe('vim_FullName', function()
function vim_FullName(filename, buffer, length, force)
local function vim_FullName(filename, buf, len, force)
filename = to_cstr(filename)
return path.vim_FullName(filename, buffer, length, force)
return path.vim_FullName(filename, buf, len, force)
end
before_each(function()
-- Create empty string buffer which will contain the resulting path.
len = (string.len(lfs.currentdir())) + 33
buffer = cstr(len, '')
length = (string.len(lfs.currentdir())) + 33
buffer = cstr(length, '')
end)
it('fails if given filename is NULL', function()
local force_expansion = 1
local result = path.vim_FullName(NULL, buffer, len, force_expansion)
local result = path.vim_FullName(NULL, buffer, length, force_expansion)
eq(FAIL, result)
end)
it('uses the filename if the filename is a URL', function()
local force_expansion = 1
local filename = 'http://www.neovim.org'
local result = vim_FullName(filename, buffer, len, force_expansion)
local result = vim_FullName(filename, buffer, length, force_expansion)
eq(filename, (ffi.string(buffer)))
eq(OK, result)
end)
@ -349,14 +347,14 @@ describe('more path function', function()
it('fails and uses filename if given filename contains non-existing directory', function()
local force_expansion = 1
local filename = 'non_existing_dir/test.file'
local result = vim_FullName(filename, buffer, len, force_expansion)
local result = vim_FullName(filename, buffer, length, force_expansion)
eq(filename, (ffi.string(buffer)))
eq(FAIL, result)
end)
it('concatenates given filename if it does not contain a slash', function()
local force_expansion = 1
local result = vim_FullName('test.file', buffer, len, force_expansion)
local result = vim_FullName('test.file', buffer, length, force_expansion)
local expected = lfs.currentdir() .. '/test.file'
eq(expected, (ffi.string(buffer)))
eq(OK, result)
@ -364,7 +362,7 @@ describe('more path function', function()
it('concatenates given filename if it is a directory but does not contain a\n slash', function()
local force_expansion = 1
local result = vim_FullName('..', buffer, len, force_expansion)
local result = vim_FullName('..', buffer, length, force_expansion)
local expected = lfs.currentdir() .. '/..'
eq(expected, (ffi.string(buffer)))
eq(OK, result)
@ -374,7 +372,7 @@ describe('more path function', function()
-- the unit tests? Which other directory would be better?
it('enters given directory (instead of just concatenating the strings) if possible and if path contains a slash', function()
local force_expansion = 1
local result = vim_FullName('../test.file', buffer, len, force_expansion)
local result = vim_FullName('../test.file', buffer, length, force_expansion)
local old_dir = lfs.currentdir()
lfs.chdir('..')
local expected = lfs.currentdir() .. '/test.file'
@ -386,7 +384,7 @@ describe('more path function', function()
it('just copies the path if it is already absolute and force=0', function()
local force_expansion = 0
local absolute_path = '/absolute/path'
local result = vim_FullName(absolute_path, buffer, len, force_expansion)
local result = vim_FullName(absolute_path, buffer, length, force_expansion)
eq(absolute_path, (ffi.string(buffer)))
eq(OK, result)
end)
@ -394,14 +392,14 @@ describe('more path function', function()
it('fails and uses filename when the path is relative to HOME', function()
local force_expansion = 1
local absolute_path = '~/home.file'
local result = vim_FullName(absolute_path, buffer, len, force_expansion)
local result = vim_FullName(absolute_path, buffer, length, force_expansion)
eq(absolute_path, (ffi.string(buffer)))
eq(FAIL, result)
end)
it('works with some "normal" relative path with directories', function()
local force_expansion = 1
local result = vim_FullName('unit-test-directory/test.file', buffer, len, force_expansion)
local result = vim_FullName('unit-test-directory/test.file', buffer, length, force_expansion)
eq(OK, result)
eq(lfs.currentdir() .. '/unit-test-directory/test.file', (ffi.string(buffer)))
end)
@ -411,7 +409,7 @@ describe('more path function', function()
local filename = to_cstr('unit-test-directory/test.file')
-- Don't use the wrapper here but pass a cstring directly to the c
-- function.
local result = path.vim_FullName(filename, buffer, len, force_expansion)
local result = path.vim_FullName(filename, buffer, length, force_expansion)
eq(lfs.currentdir() .. '/unit-test-directory/test.file', (ffi.string(buffer)))
eq('unit-test-directory/test.file', (ffi.string(filename)))
eq(OK, result)
@ -420,15 +418,15 @@ describe('more path function', function()
it('works with directories that have one path component', function()
local force_expansion = 1
local filename = to_cstr('/tmp')
local result = path.vim_FullName(filename, buffer, len, force_expansion)
local result = path.vim_FullName(filename, buffer, length, force_expansion)
eq('/tmp', ffi.string(buffer))
eq(OK, result)
end)
end)
describe('path_fix_case', function()
function fix_case(file)
c_file = to_cstr(file)
local function fix_case(file)
local c_file = to_cstr(file)
path.path_fix_case(c_file)
return ffi.string(c_file)
end
@ -493,7 +491,7 @@ describe('more path function', function()
end)
describe('path_is_absolute_path', function()
function path_is_absolute_path(filename)
local function path_is_absolute_path(filename)
filename = to_cstr(filename)
return path.path_is_absolute_path(filename)
end

View File

@ -169,8 +169,8 @@ local type_to_class = {
-- find the best cc. If os.exec causes problems on windows (like popping up
-- a console window) we might consider using something like this:
-- http://scite-ru.googlecode.com/svn/trunk/pack/tools/LuaLib/shell.html#exec
local function find_best_cc(ccs)
for _, meta in pairs(ccs) do
local function find_best_cc(compilers)
for _, meta in pairs(compilers) do
local version = io.popen(tostring(meta.path) .. " -v 2>&1")
version:close()
if version then

View File

@ -36,20 +36,20 @@ local function cmp_assert(v1, v2, op, opstr)
assert.is_true(res)
end
local function lt(v1, v2)
cmp_assert(v1, v2, function(v1, v2) return v1 < v2 end, "<")
local function lt(a, b) -- luacheck: ignore
cmp_assert(a, b, function(x, y) return x < y end, "<")
end
local function lte(v1, v2)
cmp_assert(v1, v2, function(v1, v2) return v1 <= v2 end, "<=")
local function lte(a, b) -- luacheck: ignore
cmp_assert(a, b, function(x, y) return x <= y end, "<=")
end
local function gt(v1, v2)
cmp_assert(v1, v2, function(v1, v2) return v1 > v2 end, ">")
local function gt(a, b) -- luacheck: ignore
cmp_assert(a, b, function(x, y) return x > y end, ">")
end
local function gte(v1, v2)
cmp_assert(v1, v2, function(v1, v2) return v1 >= v2 end, ">=")
local function gte(a, b)
cmp_assert(a, b, function(x, y) return x >= y end, ">=")
end
-- missing functions:
@ -70,7 +70,7 @@ describe('profiling related functions', function()
local function profile_equal(t1, t2) return prof.profile_equal(t1, t2) end
local function profile_msg(t) return ffi.string(prof.profile_msg(t)) end
local function toseconds(t)
local function toseconds(t) -- luacheck: ignore
local str = trim(profile_msg(t))
local spl = split(str, ".")
local s, us = spl[1], spl[2]
@ -122,7 +122,7 @@ describe('profiling related functions', function()
local divided = profile_divide(start, divisor)
local res = divided
for i = 1, divisor - 1 do
for _ = 1, divisor - 1 do
res = profile_add(res, divided)
end
@ -143,7 +143,7 @@ describe('profiling related functions', function()
describe('profile_start', function()
it('increases', function()
local last = profile_start()
for i=1,100 do
for _ = 1, 100 do
local curr = profile_start()
gte(curr, last)
last = curr
@ -157,7 +157,7 @@ describe('profiling related functions', function()
end)
it('outer elapsed >= inner elapsed', function()
for i = 1, 100 do
for _ = 1, 100 do
local start_outer = profile_start()
local start_inner = profile_start()
local elapsed_inner = profile_end(start_inner)
@ -238,7 +238,7 @@ describe('profiling related functions', function()
-- t2 >= t1 => profile_cmp(t1, t2) >= 0
assert.is_true(cmp >= 0)
local cmp = profile_cmp(profile_sub(start3, start1), profile_sub(start2, start1))
cmp = profile_cmp(profile_sub(start3, start1), profile_sub(start2, start1))
-- t2 <= t1 => profile_cmp(t1, t2) <= 0
assert.is_true(cmp <= 0)
end)

View File

@ -35,7 +35,7 @@ end
-- adds the argument table to this Set
function Set:union_table(t)
for k, v in pairs(t) do
for _, v in pairs(t) do
self:add(v)
end
end