tests: Fix testlint errors

This commit is contained in:
ZyX
2017-10-30 01:48:32 +03:00
parent 0356dbbb36
commit 3ecb95298f
6 changed files with 12 additions and 20 deletions

View File

@@ -898,4 +898,8 @@ describe('Expressions coloring support', function()
={NUM:1}^ | ={NUM:1}^ |
]]) ]])
end) end)
-- FIXME: Test expr coloring when using -u NORC and -u NONE.
-- FIXME: Test all highlight groups, using long expression.
-- FIXME: Test different ways of triggering expression highlighting (:<C-r>=,
-- i<C-r>=, :<C-\>e, "=).
end) end)

View File

@@ -376,8 +376,8 @@ local function format_string(fmt, ...)
return args[i] return args[i]
end end
local ret = fmt:gsub('%%[0-9*]*%.?[0-9*]*[cdEefgGiouXxqsr%%]', function(match) local ret = fmt:gsub('%%[0-9*]*%.?[0-9*]*[cdEefgGiouXxqsr%%]', function(match)
local subfmt = match:gsub('%*', function(match) local subfmt = match:gsub('%*', function()
return getarg() return tostring(getarg())
end) end)
local arg = nil local arg = nil
if subfmt:sub(-1) ~= '%' then if subfmt:sub(-1) ~= '%' then

View File

@@ -791,7 +791,7 @@ local function kvi_new(ct)
return kvi_init(ffi.new(ct)) return kvi_init(ffi.new(ct))
end end
local function make_enum_conv_tab(lib, values, skip_pref, set_cb) local function make_enum_conv_tab(m, values, skip_pref, set_cb)
child_call_once(function() child_call_once(function()
local ret = {} local ret = {}
for _, v in ipairs(values) do for _, v in ipairs(values) do
@@ -799,7 +799,7 @@ local function make_enum_conv_tab(lib, values, skip_pref, set_cb)
if v:sub(1, #skip_pref) == skip_pref then if v:sub(1, #skip_pref) == skip_pref then
str_v = v:sub(#skip_pref + 1) str_v = v:sub(#skip_pref + 1)
end end
ret[tonumber(lib[v])] = str_v ret[tonumber(m[v])] = str_v
end end
set_cb(ret) set_cb(ret)
end) end)
@@ -837,7 +837,7 @@ local module = {
child_cleanup_once = child_cleanup_once, child_cleanup_once = child_cleanup_once,
sc = sc, sc = sc,
conv_enum = conv_enum, conv_enum = conv_enum,
array_size = array_sive, array_size = array_size,
kvi_destroy = kvi_destroy, kvi_destroy = kvi_destroy,
kvi_size = kvi_size, kvi_size = kvi_size,
kvi_init = kvi_init, kvi_init = kvi_init,

View File

@@ -10,7 +10,6 @@ local ffi = helpers.ffi
local eq = helpers.eq local eq = helpers.eq
local conv_ccs = viml_helpers.conv_ccs local conv_ccs = viml_helpers.conv_ccs
local pline2lua = viml_helpers.pline2lua
local new_pstate = viml_helpers.new_pstate local new_pstate = viml_helpers.new_pstate
local intchar2lua = viml_helpers.intchar2lua local intchar2lua = viml_helpers.intchar2lua
local conv_cmp_type = viml_helpers.conv_cmp_type local conv_cmp_type = viml_helpers.conv_cmp_type
@@ -183,7 +182,7 @@ describe('Expressions lexer', function()
end end
local function simple_test(pstate_arg, exp_type, exp_len, exp) local function simple_test(pstate_arg, exp_type, exp_len, exp)
local pstate = new_pstate(pstate_arg) local pstate = new_pstate(pstate_arg)
local exp = shallowcopy(exp) exp = shallowcopy(exp)
exp.type = exp_type exp.type = exp_type
exp.len = exp_len or #(pstate_arg[0]) exp.len = exp_len or #(pstate_arg[0])
exp.start = { col = 0, line = 0 } exp.start = { col = 0, line = 0 }

View File

@@ -14,7 +14,6 @@ local ffi = helpers.ffi
local eq = helpers.eq local eq = helpers.eq
local conv_ccs = viml_helpers.conv_ccs local conv_ccs = viml_helpers.conv_ccs
local pline2lua = viml_helpers.pline2lua
local new_pstate = viml_helpers.new_pstate local new_pstate = viml_helpers.new_pstate
local intchar2lua = viml_helpers.intchar2lua local intchar2lua = viml_helpers.intchar2lua
local conv_cmp_type = viml_helpers.conv_cmp_type local conv_cmp_type = viml_helpers.conv_cmp_type
@@ -174,10 +173,7 @@ local function eastnode2lua(pstate, eastnode, checked_nodes)
ffi.string(eastnode.data.env.ident, eastnode.data.env.ident_len)) ffi.string(eastnode.data.env.ident, eastnode.data.env.ident_len))
end end
ret_str = typ .. ':' .. ret_str ret_str = typ .. ':' .. ret_str
local can_simplify = true local can_simplify = not ret.children
for k, v in pairs(ret) do
can_simplify = false
end
if can_simplify then if can_simplify then
ret = ret_str ret = ret_str
else else
@@ -218,12 +214,11 @@ local function phl2lua(pstate)
pstate, chunk.start, chunk.end_col - chunk.start.col, { pstate, chunk.start, chunk.end_col - chunk.start.col, {
group = ffi.string(chunk.group), group = ffi.string(chunk.group),
}) })
chunk_str = ('%s:%u:%u:%s'):format( ret[i + 1] = ('%s:%u:%u:%s'):format(
chunk_tbl.group, chunk_tbl.group,
chunk_tbl.start.line, chunk_tbl.start.line,
chunk_tbl.start.col, chunk_tbl.start.col,
chunk_tbl.str) chunk_tbl.str)
ret[i + 1] = chunk_str
end end
return ret return ret
end end

View File

@@ -5,7 +5,6 @@ local cimport = helpers.cimport
local kvi_new = helpers.kvi_new local kvi_new = helpers.kvi_new
local kvi_init = helpers.kvi_init local kvi_init = helpers.kvi_init
local conv_enum = helpers.conv_enum local conv_enum = helpers.conv_enum
local child_call_once = helpers.child_call_once
local make_enum_conv_tab = helpers.make_enum_conv_tab local make_enum_conv_tab = helpers.make_enum_conv_tab
local lib = cimport('./src/nvim/viml/parser/expressions.h') local lib = cimport('./src/nvim/viml/parser/expressions.h')
@@ -33,11 +32,6 @@ local function new_pstate(strings)
ret_pline.size = size ret_pline.size = size
ret_pline.allocated = false ret_pline.allocated = false
end end
local pline_init = {
data = nil,
size = 0,
allocated = false,
}
local state = { local state = {
reader = { reader = {
get_line = get_line, get_line = get_line,