summaryrefslogtreecommitdiff
path: root/test/diagnostics/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/diagnostics/init.lua')
-rw-r--r--test/diagnostics/init.lua27
1 files changed, 14 insertions, 13 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua
index dcbfb962..2821dc1b 100644
--- a/test/diagnostics/init.lua
+++ b/test/diagnostics/init.lua
@@ -4,9 +4,9 @@ local config = require 'config'
local util = require 'utility'
local catch = require 'catch'
-config.get 'Lua.diagnostics.neededFileStatus'['deprecated'] = 'Any'
-config.get 'Lua.diagnostics.neededFileStatus'['type-check'] = 'Any'
-config.get 'Lua.diagnostics.neededFileStatus'['await-in-sync'] = 'Any'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['deprecated'] = 'Any'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['type-check'] = 'Any'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['await-in-sync'] = 'Any'
rawset(_G, 'TEST', true)
@@ -28,7 +28,6 @@ end
---@diagnostic disable: await-in-sync
function TEST(script, ...)
- files.removeAll()
local newScript, catched = catch(script, '!')
files.setText('', newScript)
files.open('')
@@ -50,6 +49,8 @@ function TEST(script, ...)
else
assert(catched['!'] == nil)
end
+
+ files.remove('')
end
TEST [[
@@ -177,7 +178,7 @@ local _ENV = { print = print }
print(1)
]]
-config.get 'Lua.diagnostics.disable'['undefined-env-child'] = true
+config.get(nil, 'Lua.diagnostics.disable')['undefined-env-child'] = true
TEST [[
_ENV = nil
<!GLOBAL!> = 1 --> _ENV.GLOBAL = 1
@@ -203,7 +204,7 @@ GLOBAL = 1
_ENV = nil
]]
-config.get 'Lua.diagnostics.disable'['undefined-env-child'] = nil
+config.get(nil, 'Lua.diagnostics.disable')['undefined-env-child'] = nil
TEST [[
<!print()
('string')!>:sub(1, 1)
@@ -315,17 +316,17 @@ return [[
]]
]=]
-config.get 'Lua.diagnostics.disable'['close-non-object'] = true
+config.get(nil, 'Lua.diagnostics.disable')['close-non-object'] = true
TEST [[
local _ <close> = function () end
]]
-config.get 'Lua.diagnostics.disable'['close-non-object'] = nil
+config.get(nil, 'Lua.diagnostics.disable')['close-non-object'] = nil
TEST [[
local _ <close> = <!1!>
]]
-config.get 'Lua.diagnostics.disable'['unused-local'] = true
+config.get(nil, 'Lua.diagnostics.disable')['unused-local'] = true
TEST [[
local f = <!function () end!>
]]
@@ -338,7 +339,7 @@ TEST [[
local <!function f() end!>
]]
-config.get 'Lua.diagnostics.disable'['unused-local'] = nil
+config.get(nil, 'Lua.diagnostics.disable')['unused-local'] = nil
TEST [[
local mt, x
function mt:m()
@@ -1162,7 +1163,7 @@ TEST [[
local emit = {}
]]
-config.get 'Lua.diagnostics.neededFileStatus' ['unused-local'] = 'None'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['unused-local'] = 'None'
TEST [[
---@param table table
---@param metatable table
@@ -1301,7 +1302,7 @@ trim('str', 'left')
trim('str', nil)
]]
-config.get 'Lua.diagnostics.neededFileStatus' ['unused-local'] = 'Any'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['unused-local'] = 'Any'
---不完整的函数参数定义,会跳过检查
TEST [[
@@ -1438,7 +1439,7 @@ end
X = f()
]]
-config.get 'Lua.diagnostics.neededFileStatus'['not-yieldable'] = 'Any'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['not-yieldable'] = 'Any'
TEST [[
local function f(cb)
return cb