summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/completion/common.lua12
-rw-r--r--test/completion/continue.lua6
-rw-r--r--test/crossfile/allreferences.lua5
-rw-r--r--test/crossfile/completion.lua24
-rw-r--r--test/crossfile/definition.lua16
-rw-r--r--test/crossfile/diagnostic.lua4
-rw-r--r--test/definition/bug.lua4
-rw-r--r--test/diagnostics/init.lua20
-rw-r--r--test/full/example.lua2
-rw-r--r--test/full/init.lua4
-rw-r--r--test/full/projects.lua4
-rw-r--r--test/hover/init.lua12
-rw-r--r--test/references/all.lua4
-rw-r--r--test/references/common.lua16
-rw-r--r--test/rename/init.lua4
-rw-r--r--test/type_inference/init.lua16
16 files changed, 76 insertions, 77 deletions
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 60a5f2ac..fad0df8e 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -1,10 +1,10 @@
local define = require 'proto.define'
local config = require 'config'
-config.set('Lua.completion.callSnippet', 'Both')
-config.set('Lua.completion.keywordSnippet', 'Both')
-config.set('Lua.completion.workspaceWord', false)
-config.set('Lua.completion.showWord', 'Enable')
+config.set(nil, 'Lua.completion.callSnippet', 'Both')
+config.set(nil, 'Lua.completion.keywordSnippet', 'Both')
+config.set(nil, 'Lua.completion.workspaceWord', false)
+config.set(nil, 'Lua.completion.showWord', 'Enable')
TEST [[
local zabcde
@@ -805,7 +805,7 @@ print(io.<??>)
]]
(EXISTS)
-require 'config'.set('Lua.runtime.version', 'Lua 5.4')
+require 'config'.set(nil, 'Lua.runtime.version', 'Lua 5.4')
--TEST [[
--local <??>
--]]
@@ -2402,7 +2402,7 @@ end
]]
(EXISTS)
-config.set('Lua.completion.callSnippet', 'Disable')
+config.set(nil, 'Lua.completion.callSnippet', 'Disable')
TEST [[
GGG = 1
diff --git a/test/completion/continue.lua b/test/completion/continue.lua
index 63f970e9..83eaf270 100644
--- a/test/completion/continue.lua
+++ b/test/completion/continue.lua
@@ -1,9 +1,9 @@
local define = require 'proto.define'
local config = require 'config'
-config.set('Lua.completion.callSnippet', 'Disable')
-config.set('Lua.completion.keywordSnippet', 'Disable')
-config.set('Lua.completion.workspaceWord', false)
+config.set(nil, 'Lua.completion.callSnippet', 'Disable')
+config.set(nil, 'Lua.completion.keywordSnippet', 'Disable')
+config.set(nil, 'Lua.completion.workspaceWord', false)
ContinueTyping = true
diff --git a/test/crossfile/allreferences.lua b/test/crossfile/allreferences.lua
index 6c7febeb..2753d785 100644
--- a/test/crossfile/allreferences.lua
+++ b/test/crossfile/allreferences.lua
@@ -68,7 +68,7 @@ TEST {
},
}
-config.set('Lua.IntelliSense.traceBeSetted', true)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', true)
TEST {
{
path = 'a.lua',
@@ -215,5 +215,4 @@ TEST {
]]
},
}
-config.set('Lua.IntelliSense.traceBeSetted', false)
-
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', false)
diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua
index 50ebad45..c608ccab 100644
--- a/test/crossfile/completion.lua
+++ b/test/crossfile/completion.lua
@@ -307,8 +307,8 @@ TEST {
}
}
-local originSeparator = config.get 'Lua.completion.requireSeparator'
-config.set('Lua.completion.requireSeparator', '/')
+local originSeparator = config.get(nil, 'Lua.completion.requireSeparator')
+config.set(nil, 'Lua.completion.requireSeparator', '/')
TEST {
{
path = 'abc.lua',
@@ -331,7 +331,7 @@ TEST {
},
}
}
-config.set('Lua.completion.requireSeparator', originSeparator)
+config.set(nil, 'Lua.completion.requireSeparator', originSeparator)
TEST {
{
@@ -390,8 +390,8 @@ TEST {
}
-local originRuntimePath = config.get 'Lua.runtime.path'
-config.set('Lua.runtime.path', {
+local originRuntimePath = config.get(nil, 'Lua.runtime.path')
+config.set(nil, 'Lua.runtime.path', {
'?/1.lua',
})
@@ -419,10 +419,10 @@ TEST {
}
}
-config.set('Lua.runtime.path', originRuntimePath)
+config.set(nil, 'Lua.runtime.path', originRuntimePath)
-local originRuntimePath = config.get 'Lua.runtime.path'
-config.set('Lua.runtime.path', {
+local originRuntimePath = config.get(nil, 'Lua.runtime.path')
+config.set(nil, 'Lua.runtime.path', {
'D:/?/1.lua',
})
@@ -445,7 +445,7 @@ TEST {
}
}
-config.set('Lua.runtime.path', originRuntimePath)
+config.set(nil, 'Lua.runtime.path', originRuntimePath)
TEST {
{
@@ -627,7 +627,7 @@ TEST {
}
}
-config.set('Lua.runtime.pathStrict', true)
+config.set(nil, 'Lua.runtime.pathStrict', true)
TEST {
{ path = 'f/a.lua' },
@@ -672,7 +672,7 @@ TEST {
}
}
-config.set('Lua.runtime.pathStrict', false)
+config.set(nil, 'Lua.runtime.pathStrict', false)
TEST {
{
@@ -960,7 +960,7 @@ TEST {
completion = EXISTS
}
-config.prop('Lua.runtime.special', 'import', 'require')
+config.prop(nil, 'Lua.runtime.special', 'import', 'require')
TEST {
{ path = 'abcde.lua', content = '' },
{
diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua
index 058f5d18..8f4dd7e8 100644
--- a/test/crossfile/definition.lua
+++ b/test/crossfile/definition.lua
@@ -117,7 +117,7 @@ TEST {
},
}
-config.set('Lua.runtime.pathStrict', true)
+config.set(nil, 'Lua.runtime.pathStrict', true)
TEST {
{
path = 'aaa/bbb.lua',
@@ -140,7 +140,7 @@ TEST {
},
}
-config.set('Lua.runtime.pathStrict', false)
+config.set(nil, 'Lua.runtime.pathStrict', false)
TEST {
{
@@ -740,8 +740,8 @@ TEST {
}
platform.OS = originOS
-local originRuntimePath = config.get 'Lua.runtime.path'
-config.set('Lua.runtime.path', {
+local originRuntimePath = config.get(nil, 'Lua.runtime.path')
+config.set(nil, 'Lua.runtime.path', {
'?/1.lua',
})
TEST {
@@ -760,7 +760,7 @@ TEST {
},
}
-config.set('Lua.runtime.path', {
+config.set(nil, 'Lua.runtime.path', {
'D:/?/1.lua',
})
TEST {
@@ -778,7 +778,7 @@ TEST {
]],
},
}
-config.set('Lua.runtime.path', originRuntimePath)
+config.set(nil, 'Lua.runtime.path', originRuntimePath)
TEST {
{
@@ -795,7 +795,7 @@ TEST {
},
}
-config.set('Lua.IntelliSense.traceFieldInject', true)
+config.set(nil, 'Lua.IntelliSense.traceFieldInject', true)
TEST {
{
path = 'a.lua',
@@ -816,7 +816,7 @@ print(b.<?test?>)
]]
}
}
-config.set('Lua.IntelliSense.traceFieldInject', false)
+config.set(nil, 'Lua.IntelliSense.traceFieldInject', false)
TEST {
{
diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua
index c2d043f4..9bdce197 100644
--- a/test/crossfile/diagnostic.lua
+++ b/test/crossfile/diagnostic.lua
@@ -5,8 +5,8 @@ local config = require 'config'
local platform = require 'bee.platform'
local catch = require 'catch'
-config.get 'Lua.diagnostics.neededFileStatus'['deprecated'] = 'Any'
-config.get 'Lua.diagnostics.neededFileStatus'['type-check'] = 'Any'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['deprecated'] = 'Any'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['type-check'] = 'Any'
rawset(_G, 'TEST', true)
diff --git a/test/definition/bug.lua b/test/definition/bug.lua
index 7a2cc789..e8733636 100644
--- a/test/definition/bug.lua
+++ b/test/definition/bug.lua
@@ -172,7 +172,7 @@ string.xx:<?format?>()
--v.<?bar1?>
--]]
-config.set('Lua.IntelliSense.traceLocalSet', true)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', true)
TEST [[
local A, B
@@ -232,7 +232,7 @@ end
local <!b!> = B:get()
print(<?b?>)
]]
-config.set('Lua.IntelliSense.traceLocalSet', false)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', false)
TEST [[
g[a.b.c] = 1
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua
index 558ffc26..3dfd6518 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)
@@ -177,7 +177,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 +203,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 +315,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 +338,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()
@@ -1427,7 +1427,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
diff --git a/test/full/example.lua b/test/full/example.lua
index 0505f1a5..c0ce23ee 100644
--- a/test/full/example.lua
+++ b/test/full/example.lua
@@ -10,7 +10,7 @@ local noder = require 'core.noder'
-- 临时
---@diagnostic disable: await-in-sync
local function testIfExit(path)
- config.set('Lua.workspace.preloadFileSize', 1000000000)
+ config.set(nil, 'Lua.workspace.preloadFileSize', 1000000000)
local buf = util.loadFile(path:string())
if buf then
local state
diff --git a/test/full/init.lua b/test/full/init.lua
index 9584db6f..e83a7d6d 100644
--- a/test/full/init.lua
+++ b/test/full/init.lua
@@ -12,9 +12,9 @@ function TEST(script)
end
local function startCollectDiagTimes()
- for name in pairs(config.get 'Lua.diagnostics.neededFileStatus') do
+ for name in pairs(config.get(nil, 'Lua.diagnostics.neededFileStatus')) do
if name ~= 'no-implicit-any' then
- --config.get 'Lua.diagnostics.neededFileStatus'[name] = 'Any'
+ --config.get(nil, 'Lua.diagnostics.neededFileStatus')[name] = 'Any'
end
end
DIAGTIMES = {}
diff --git a/test/full/projects.lua b/test/full/projects.lua
index a095f316..7beaa026 100644
--- a/test/full/projects.lua
+++ b/test/full/projects.lua
@@ -6,8 +6,8 @@ local config = require 'config'
local ws = require 'workspace'
local fs = require 'bee.filesystem'
-config.set('Lua.workspace.preloadFileSize', 1000000)
-config.set('Lua.diagnostics.neededFileStatus', {
+config.set(nil, 'Lua.workspace.preloadFileSize', 1000000)
+config.set(nil, 'Lua.diagnostics.neededFileStatus', {
['await-in-sync'] = 'Any',
['not-yieldable'] = 'Any',
})
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 15bf60d4..35274384 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -838,7 +838,7 @@ local t: {
}
]]
-config.set('Lua.IntelliSense.traceLocalSet', true)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', true)
TEST [[
local x
x = 1
@@ -849,7 +849,7 @@ print(<?x?>)
[[
local x: number = 1
]]
-config.set('Lua.IntelliSense.traceLocalSet', false)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', false)
TEST [[
local <?x?> <close> = 1
@@ -1730,7 +1730,7 @@ t.<?x?>()
field t.x: any
]]
-config.set('Lua.IntelliSense.traceLocalSet', true)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', true)
TEST [[
---@class A
local a
@@ -1743,7 +1743,7 @@ print(b.<?x?>)
[[
field A.x: any
]]
-config.set('Lua.IntelliSense.traceLocalSet', false)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', false)
TEST [[
---@class A
@@ -1793,11 +1793,11 @@ local <?f?>
local f: async fun()
]]
-config.set('Lua.runtime.nonstandardSymbol', { '//' })
+config.set(nil, 'Lua.runtime.nonstandardSymbol', { '//' })
TEST [[
local <?x?> = 1 // 2
]]
[[
local x: integer = 1
]]
-config.set('runtime.nonstandardSymbol', {})
+config.set(nil, 'runtime.nonstandardSymbol', {})
diff --git a/test/references/all.lua b/test/references/all.lua
index cbe8ebb5..4ba63579 100644
--- a/test/references/all.lua
+++ b/test/references/all.lua
@@ -78,7 +78,7 @@ end
local _, <!f2!> = f()
]]
-config.set('Lua.IntelliSense.traceReturn', true)
+config.set(nil, 'Lua.IntelliSense.traceReturn', true)
TEST [[
local <?x?>
local function f()
@@ -96,7 +96,7 @@ local function f()
end
local <!y!> = f()()
]]
-config.set('Lua.IntelliSense.traceReturn', false)
+config.set(nil, 'Lua.IntelliSense.traceReturn', false)
TEST [[
---@class A
diff --git a/test/references/common.lua b/test/references/common.lua
index 20ddd353..b46aa81f 100644
--- a/test/references/common.lua
+++ b/test/references/common.lua
@@ -96,7 +96,7 @@ t.x = 1
t[a.b.<?x?>] = 1
]]
-config.set('Lua.IntelliSense.traceBeSetted', true)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', true)
TEST [[
local t
local <!f!> = t.<?f?>
@@ -107,7 +107,7 @@ return {
<!f!> = <!f!>,
}
]]
-config.set('Lua.IntelliSense.traceBeSetted', false)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', false)
TEST [[
self = {
@@ -142,7 +142,7 @@ a.<!b!>.c = 1
print(a.<?b?>.c)
]]
-config.set('Lua.IntelliSense.traceBeSetted', true)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', true)
TEST [[
local <?f?>
local t = {
@@ -150,14 +150,14 @@ local t = {
}
print(t.<!a!>)
]]
-config.set('Lua.IntelliSense.traceBeSetted', false)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', false)
TEST [[
local <!f!>
local <!t!> = <?f?>
]]
-config.set('Lua.IntelliSense.traceBeSetted', true)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', true)
TEST [[
local <!f!>
a.<!t!> = <?f?>
@@ -166,19 +166,19 @@ a.<!t!> = <?f?>
TEST [[
<!t!>.<!f!> = <?t?>
]]
-config.set('Lua.IntelliSense.traceBeSetted', false)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', false)
TEST [[
local <!f!>
local <?t?> = <!f!>
]]
-config.set('Lua.IntelliSense.traceBeSetted', true)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', true)
TEST [[
local <!t!>
<!t!>.<!f!> = <?t?>
]]
-config.set('Lua.IntelliSense.traceBeSetted', false)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', false)
TEST [[
_G.<?xxx?> = 1
diff --git a/test/rename/init.lua b/test/rename/init.lua
index 774c86d2..29e6f1a6 100644
--- a/test/rename/init.lua
+++ b/test/rename/init.lua
@@ -90,7 +90,7 @@ local function f(b)
end
]]
-config.set('Lua.IntelliSense.traceBeSetted', true)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', true)
TEST ('a', '!!!') [[
t = {
a = 0
@@ -118,7 +118,7 @@ t = {
t["!!!"] = 1
a = t["!!!"]
]]
-config.set('Lua.IntelliSense.traceBeSetted', false)
+config.set(nil, 'Lua.IntelliSense.traceBeSetted', false)
TEST ('a', '"') [[
print(t[ "a" ])
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 36357771..284ca023 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -57,7 +57,7 @@ local var = '111'
t.<?x?> = var
]]
-config.set('Lua.IntelliSense.traceLocalSet', true)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', true)
TEST 'string' [[
local <?var?>
var = '111'
@@ -68,7 +68,7 @@ local var
var = '111'
print(<?var?>)
]]
-config.set('Lua.IntelliSense.traceLocalSet', false)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', false)
TEST 'function' [[
function <?xx?>()
@@ -80,13 +80,13 @@ local function <?xx?>()
end
]]
-config.set('Lua.IntelliSense.traceLocalSet', true)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', true)
TEST 'function' [[
local xx
<?xx?> = function ()
end
]]
-config.set('Lua.IntelliSense.traceLocalSet', false)
+config.set(nil, 'Lua.IntelliSense.traceLocalSet', false)
TEST 'table' [[
local <?t?> = {}
@@ -748,25 +748,25 @@ TEST 'function' [[
string.gsub():gsub():<?gsub?>()
]]
-config.set('Lua.hover.enumsLimit', 5)
+config.set(nil, 'Lua.hover.enumsLimit', 5)
TEST 'a|b|c|d|e...(+5)' [[
---@type 'a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'|'i'|'j'
local <?t?>
]]
-config.set('Lua.hover.enumsLimit', 1)
+config.set(nil, 'Lua.hover.enumsLimit', 1)
TEST 'a...(+9)' [[
---@type 'a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'|'i'|'j'
local <?t?>
]]
-config.set('Lua.hover.enumsLimit', 0)
+config.set(nil, 'Lua.hover.enumsLimit', 0)
TEST '...(+10)' [[
---@type 'a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'|'i'|'j'
local <?t?>
]]
-config.set('Lua.hover.enumsLimit', 5)
+config.set(nil, 'Lua.hover.enumsLimit', 5)
TEST 'string|fun():string' [[
---@type string | fun(): string