From c3836e40a2bffbc1d4e06531145b7825788dd818 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 4 Dec 2023 14:32:39 -0800 Subject: build: enable lintlua for test/unit/ dir #26396 Problem: Not all Lua code is checked by stylua. Automating code-style is an important mechanism for reducing time spent on accidental (non-essential) complexity. Solution: - Enable lintlua for `test/unit/` directory. - TODO: only `test/functional/` remains unchecked. previous: 45fe4d11add933df76a2ea4bf52ce8904f4a778b previous: 517f0cc634b985057da5b95cf4ad659ee456a77e --- test/unit/viml/helpers.lua | 59 +++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 19 deletions(-) (limited to 'test/unit/viml/helpers.lua') diff --git a/test/unit/viml/helpers.lua b/test/unit/viml/helpers.lua index 9d8102e023..92661e3027 100644 --- a/test/unit/viml/helpers.lua +++ b/test/unit/viml/helpers.lua @@ -76,7 +76,7 @@ local function pstate_set_str(pstate, start, len, ret) ret = ret or {} ret.start = { line = tonumber(start.line), - col = tonumber(start.col) + col = tonumber(start.col), } ret.len = tonumber(len) ret.str, ret.error = pstate_str(pstate, start, len) @@ -84,36 +84,57 @@ local function pstate_set_str(pstate, start, len, ret) end local eltkn_cmp_type_tab -make_enum_conv_tab(lib, { - 'kExprCmpEqual', - 'kExprCmpMatches', - 'kExprCmpGreater', - 'kExprCmpGreaterOrEqual', - 'kExprCmpIdentical', -}, 'kExprCmp', function(ret) eltkn_cmp_type_tab = ret end) +make_enum_conv_tab( + lib, + { + 'kExprCmpEqual', + 'kExprCmpMatches', + 'kExprCmpGreater', + 'kExprCmpGreaterOrEqual', + 'kExprCmpIdentical', + }, + 'kExprCmp', + function(ret) + eltkn_cmp_type_tab = ret + end +) local function conv_cmp_type(typ) return conv_enum(eltkn_cmp_type_tab, typ) end local ccs_tab -make_enum_conv_tab(lib, { - 'kCCStrategyUseOption', - 'kCCStrategyMatchCase', - 'kCCStrategyIgnoreCase', -}, 'kCCStrategy', function(ret) ccs_tab = ret end) +make_enum_conv_tab( + lib, + { + 'kCCStrategyUseOption', + 'kCCStrategyMatchCase', + 'kCCStrategyIgnoreCase', + }, + 'kCCStrategy', + function(ret) + ccs_tab = ret + end +) local function conv_ccs(ccs) return conv_enum(ccs_tab, ccs) end local expr_asgn_type_tab -make_enum_conv_tab(lib, { - 'kExprAsgnPlain', - 'kExprAsgnAdd', - 'kExprAsgnSubtract', - 'kExprAsgnConcat', -}, 'kExprAsgn', function(ret) expr_asgn_type_tab = ret end) +make_enum_conv_tab( + lib, + { + 'kExprAsgnPlain', + 'kExprAsgnAdd', + 'kExprAsgnSubtract', + 'kExprAsgnConcat', + }, + 'kExprAsgn', + function(ret) + expr_asgn_type_tab = ret + end +) local function conv_expr_asgn_type(expr_asgn_type) return conv_enum(expr_asgn_type_tab, expr_asgn_type) -- cgit