diff options
Diffstat (limited to 'test/diagnostics/common.lua')
-rw-r--r-- | test/diagnostics/common.lua | 15 |
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() |