aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-10-30 01:48:32 +0300
committerZyX <kp-pav@yandex.ru>2017-11-06 01:17:37 +0300
commit3ecb95298ffd9ef6ee681876f2d32553fd222b96 (patch)
tree0085994aa9e95957abef84f84a6b29714a31d53c
parent0356dbbb36ffa7934c35e9dbfc6667f9118c244f (diff)
downloadrneovim-3ecb95298ffd9ef6ee681876f2d32553fd222b96.tar.gz
rneovim-3ecb95298ffd9ef6ee681876f2d32553fd222b96.tar.bz2
rneovim-3ecb95298ffd9ef6ee681876f2d32553fd222b96.zip
tests: Fix testlint errors
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua4
-rw-r--r--test/helpers.lua4
-rw-r--r--test/unit/helpers.lua6
-rw-r--r--test/unit/viml/expressions/lexer_spec.lua3
-rw-r--r--test/unit/viml/expressions/parser_spec.lua9
-rw-r--r--test/unit/viml/helpers.lua6
6 files changed, 12 insertions, 20 deletions
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua
index 60a4a815e7..b16b4a5602 100644
--- a/test/functional/ui/cmdline_highlight_spec.lua
+++ b/test/functional/ui/cmdline_highlight_spec.lua
@@ -898,4 +898,8 @@ describe('Expressions coloring support', function()
={NUM:1}^ |
]])
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)
diff --git a/test/helpers.lua b/test/helpers.lua
index 83e78ba059..10f2f80191 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -376,8 +376,8 @@ local function format_string(fmt, ...)
return args[i]
end
local ret = fmt:gsub('%%[0-9*]*%.?[0-9*]*[cdEefgGiouXxqsr%%]', function(match)
- local subfmt = match:gsub('%*', function(match)
- return getarg()
+ local subfmt = match:gsub('%*', function()
+ return tostring(getarg())
end)
local arg = nil
if subfmt:sub(-1) ~= '%' then
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index 68ce9eed62..96aa505739 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -791,7 +791,7 @@ local function kvi_new(ct)
return kvi_init(ffi.new(ct))
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()
local ret = {}
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
str_v = v:sub(#skip_pref + 1)
end
- ret[tonumber(lib[v])] = str_v
+ ret[tonumber(m[v])] = str_v
end
set_cb(ret)
end)
@@ -837,7 +837,7 @@ local module = {
child_cleanup_once = child_cleanup_once,
sc = sc,
conv_enum = conv_enum,
- array_size = array_sive,
+ array_size = array_size,
kvi_destroy = kvi_destroy,
kvi_size = kvi_size,
kvi_init = kvi_init,
diff --git a/test/unit/viml/expressions/lexer_spec.lua b/test/unit/viml/expressions/lexer_spec.lua
index 5910468017..d4ec870a4e 100644
--- a/test/unit/viml/expressions/lexer_spec.lua
+++ b/test/unit/viml/expressions/lexer_spec.lua
@@ -10,7 +10,6 @@ local ffi = helpers.ffi
local eq = helpers.eq
local conv_ccs = viml_helpers.conv_ccs
-local pline2lua = viml_helpers.pline2lua
local new_pstate = viml_helpers.new_pstate
local intchar2lua = viml_helpers.intchar2lua
local conv_cmp_type = viml_helpers.conv_cmp_type
@@ -183,7 +182,7 @@ describe('Expressions lexer', function()
end
local function simple_test(pstate_arg, exp_type, exp_len, exp)
local pstate = new_pstate(pstate_arg)
- local exp = shallowcopy(exp)
+ exp = shallowcopy(exp)
exp.type = exp_type
exp.len = exp_len or #(pstate_arg[0])
exp.start = { col = 0, line = 0 }
diff --git a/test/unit/viml/expressions/parser_spec.lua b/test/unit/viml/expressions/parser_spec.lua
index 019fe69046..df69c60dd0 100644
--- a/test/unit/viml/expressions/parser_spec.lua
+++ b/test/unit/viml/expressions/parser_spec.lua
@@ -14,7 +14,6 @@ local ffi = helpers.ffi
local eq = helpers.eq
local conv_ccs = viml_helpers.conv_ccs
-local pline2lua = viml_helpers.pline2lua
local new_pstate = viml_helpers.new_pstate
local intchar2lua = viml_helpers.intchar2lua
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))
end
ret_str = typ .. ':' .. ret_str
- local can_simplify = true
- for k, v in pairs(ret) do
- can_simplify = false
- end
+ local can_simplify = not ret.children
if can_simplify then
ret = ret_str
else
@@ -218,12 +214,11 @@ local function phl2lua(pstate)
pstate, chunk.start, chunk.end_col - chunk.start.col, {
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.start.line,
chunk_tbl.start.col,
chunk_tbl.str)
- ret[i + 1] = chunk_str
end
return ret
end
diff --git a/test/unit/viml/helpers.lua b/test/unit/viml/helpers.lua
index c965cacb29..70949e8278 100644
--- a/test/unit/viml/helpers.lua
+++ b/test/unit/viml/helpers.lua
@@ -5,7 +5,6 @@ local cimport = helpers.cimport
local kvi_new = helpers.kvi_new
local kvi_init = helpers.kvi_init
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 lib = cimport('./src/nvim/viml/parser/expressions.h')
@@ -33,11 +32,6 @@ local function new_pstate(strings)
ret_pline.size = size
ret_pline.allocated = false
end
- local pline_init = {
- data = nil,
- size = 0,
- allocated = false,
- }
local state = {
reader = {
get_line = get_line,