summaryrefslogtreecommitdiff
path: root/test/tclient/tests/modify-luarc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/tclient/tests/modify-luarc.lua')
-rw-r--r--test/tclient/tests/modify-luarc.lua150
1 files changed, 150 insertions, 0 deletions
diff --git a/test/tclient/tests/modify-luarc.lua b/test/tclient/tests/modify-luarc.lua
index 94756847..11de446b 100644
--- a/test/tclient/tests/modify-luarc.lua
+++ b/test/tclient/tests/modify-luarc.lua
@@ -39,6 +39,26 @@ lclient():start(function (languageClient)
-------------------------------
+ util.saveFile(configPath, jsonb.beautify {
+ ['Lua.runtime.version'] = json.null,
+ })
+
+ provider.updateConfig()
+
+ client.setConfig({
+ {
+ action = 'set',
+ key = 'Lua.runtime.version',
+ value = 'LuaJIT',
+ }
+ })
+
+ assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), {
+ ['Lua.runtime.version'] = 'LuaJIT',
+ }))
+
+ -------------------------------
+
util.saveFile(configPath, jsonb.beautify(json.createEmptyObject()))
provider.updateConfig()
@@ -174,4 +194,134 @@ lclient():start(function (languageClient)
}
}))
+ -------------------------------
+
+ util.saveFile(configPath, jsonb.beautify {
+ ['runtime.version'] = json.null,
+ })
+
+ provider.updateConfig()
+
+ client.setConfig({
+ {
+ action = 'set',
+ key = 'Lua.runtime.version',
+ value = 'LuaJIT',
+ }
+ })
+
+ assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), {
+ ['runtime.version'] = 'LuaJIT',
+ }))
+
+ -------------------------------
+
+ util.saveFile(configPath, jsonb.beautify {
+ Lua = {
+ runtime = {
+ version = json.null,
+ }
+ }
+ })
+
+ provider.updateConfig()
+
+ client.setConfig({
+ {
+ action = 'set',
+ key = 'Lua.runtime.version',
+ value = 'LuaJIT',
+ }
+ })
+
+ assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), {
+ Lua = {
+ runtime = {
+ version = 'LuaJIT',
+ }
+ }
+ }))
+
+ -------------------------------
+
+ util.saveFile(configPath, jsonb.beautify {
+ runtime = {
+ version = json.null,
+ }
+ })
+
+ provider.updateConfig()
+
+ client.setConfig({
+ {
+ action = 'set',
+ key = 'Lua.runtime.version',
+ value = 'LuaJIT',
+ }
+ })
+
+ assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), {
+ runtime = {
+ version = 'LuaJIT',
+ }
+ }))
+
+ -------------------------------
+
+ util.saveFile(configPath, jsonb.beautify {
+ diagnostics = {
+ disable = {
+ 'unused-local',
+ }
+ }
+ })
+
+ provider.updateConfig()
+
+ client.setConfig({
+ {
+ action = 'add',
+ key = 'Lua.diagnostics.disable',
+ value = 'undefined-global',
+ }
+ })
+
+ assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), {
+ diagnostics = {
+ disable = {
+ 'unused-local',
+ 'undefined-global',
+ }
+ }
+ }))
+
+ -------------------------------
+
+ util.saveFile(configPath, jsonb.beautify {
+ runtime = {
+ special = {
+ import = 'require',
+ }
+ }
+ })
+
+ provider.updateConfig()
+
+ client.setConfig({
+ {
+ action = 'prop',
+ key = 'Lua.runtime.special',
+ prop = 'include',
+ value = 'require',
+ }
+ })
+
+ assert(util.equal(jsonc.decode_jsonc(util.loadFile(configPath)), {
+ runtime = {
+ special = {
+ import = 'require',
+ include = 'require',
+ }
+ }
+ }))
end)