summaryrefslogtreecommitdiff
path: root/test/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-07 21:27:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-07 21:27:45 +0800
commit680e6c9848a6e5f43ccce11561ec98839822bdea (patch)
tree829e587428002e9fdd3f82364c39490d2c3f0c24 /test/diagnostics
parent5762f1bdc412a128489f0ad27124193fedfb13e9 (diff)
downloadlua-language-server-680e6c9848a6e5f43ccce11561ec98839822bdea.zip
cleanup
Diffstat (limited to 'test/diagnostics')
-rw-r--r--test/diagnostics/common.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua
index eddf9c26..74cd09f3 100644
--- a/test/diagnostics/common.lua
+++ b/test/diagnostics/common.lua
@@ -1,4 +1,7 @@
local config = require 'config'
+local util = require 'utility'
+
+local disables = config.get(nil, 'Lua.diagnostics.disable')
TEST [[
local <!x!>
@@ -125,7 +128,7 @@ local _ENV = { print = print }
print(1)
]]
-config.get(nil, 'Lua.diagnostics.disable')['undefined-env-child'] = true
+util.arrayInsert(disables, 'undefined-env-child')
TEST [[
_ENV = nil
<!GLOBAL!> = 1 --> _ENV.GLOBAL = 1
@@ -151,7 +154,7 @@ GLOBAL = 1
_ENV = nil
]]
-config.get(nil, 'Lua.diagnostics.disable')['undefined-env-child'] = nil
+util.arrayRemove(disables, 'undefined-env-child')
TEST [[
<!print()
('string')!>:sub(1, 1)
@@ -355,12 +358,12 @@ return [[
]]
]=]
-config.get(nil, 'Lua.diagnostics.disable')['close-non-object'] = true
+util.arrayInsert(disables, 'close-non-object')
TEST [[
local _ <close> = function () end
]]
+util.arrayRemove(disables, 'close-non-object')
-config.get(nil, 'Lua.diagnostics.disable')['close-non-object'] = nil
TEST [[
local _ <close> = <!1!>
]]
@@ -373,7 +376,7 @@ TEST [[
local c <close> = <!(function () return 1 end)()!>
]]
-config.get(nil, 'Lua.diagnostics.disable')['unused-local'] = true
+util.arrayInsert(disables, 'unused-local')
TEST [[
local f = <!function () end!>
]]
@@ -401,7 +404,7 @@ local <!function foo ()
end!>
]]
-config.get(nil, 'Lua.diagnostics.disable')['unused-local'] = nil
+util.arrayRemove(disables, 'unused-local')
TEST [[
local mt, x
function mt:m()