summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-02-04 03:51:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-02-04 03:51:43 +0800
commit32cdecde294924771f4a2c379bdab83817b7d38e (patch)
tree63cb49f23e9428355c752ef393c8f9010189c696 /test
parentc602d39994f92b5780faf9e9f504f2a29e484864 (diff)
downloadlua-language-server-32cdecde294924771f4a2c379bdab83817b7d38e.zip
should write complete array or object into json
#1859
Diffstat (limited to 'test')
-rw-r--r--test/tclient/tests/modify-luarc.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/tclient/tests/modify-luarc.lua b/test/tclient/tests/modify-luarc.lua
index 240ae582..62d97a41 100644
--- a/test/tclient/tests/modify-luarc.lua
+++ b/test/tclient/tests/modify-luarc.lua
@@ -6,6 +6,7 @@ local jsonb = require 'json-beautify'
local client = require 'client'
local provider = require 'provider'
local json = require 'json'
+local config = require 'config'
local configPath = LOGPATH .. '/modify-luarc.json'
@@ -324,4 +325,53 @@ lclient():start(function (languageClient)
}
}
}))
+
+ -------------------------------
+ -- merrge other configs --
+ -------------------------------
+
+ util.saveFile(configPath, jsonb.beautify(json.createEmptyObject()))
+
+ provider.updateConfig()
+
+ config.add(nil, 'Lua.diagnostics.globals', 'x')
+ config.add(nil, 'Lua.diagnostics.globals', 'y')
+
+ client.setConfig({
+ {
+ action = 'add',
+ key = 'Lua.diagnostics.globals',
+ value = 'z',
+ }
+ })
+
+ assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), {
+ ['diagnostics.globals'] = { 'x', 'y', 'z' }
+ }))
+
+ -------------------------------
+
+ util.saveFile(configPath, jsonb.beautify(json.createEmptyObject()))
+
+ provider.updateConfig()
+
+ config.prop(nil, 'Lua.runtime.special', 'kx', 'require')
+ config.prop(nil, 'Lua.runtime.special', 'ky', 'require')
+
+ client.setConfig({
+ {
+ action = 'prop',
+ key = 'Lua.runtime.special',
+ prop = 'kz',
+ value = 'require',
+ }
+ })
+
+ assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), {
+ ['runtime.special'] = {
+ ['kx'] = 'require',
+ ['ky'] = 'require',
+ ['kz'] = 'require',
+ }
+ }))
end)