aboutsummaryrefslogtreecommitdiff
path: root/test/unit/formatc.lua
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2015-11-23 13:58:35 +0100
committerMarco Hinz <mh.codebro@gmail.com>2015-11-23 13:58:35 +0100
commit369c1fdb259daf4f305ada8744e0564250480398 (patch)
treee61dc677cf85faa79a92814cbdadb63de7477635 /test/unit/formatc.lua
parent97cee2c2e39888b33a546ba5ffe37c510740c3a5 (diff)
parentd9fbc1865bf5237235e96ae8822326faa84ff9fc (diff)
downloadrneovim-369c1fdb259daf4f305ada8744e0564250480398.tar.gz
rneovim-369c1fdb259daf4f305ada8744e0564250480398.tar.bz2
rneovim-369c1fdb259daf4f305ada8744e0564250480398.zip
Merge PR #3687 'Add luacheck for linting tests'
Diffstat (limited to 'test/unit/formatc.lua')
-rw-r--r--test/unit/formatc.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/unit/formatc.lua b/test/unit/formatc.lua
index f9397eaec6..3f86c5f1b1 100644
--- a/test/unit/formatc.lua
+++ b/test/unit/formatc.lua
@@ -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')