summaryrefslogtreecommitdiff
path: root/test/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2024-08-16 16:55:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2024-08-16 16:55:57 +0800
commit080d672ee4bbc082a24aef95821860afa78a7d9f (patch)
tree687c6229d6a904d1e31ee240254d83f93d83508d /test/diagnostics
parent18ae29cd86dd7e6caa45eba9ac05c44170970df3 (diff)
downloadlua-language-server-080d672ee4bbc082a24aef95821860afa78a7d9f.zip
Add setting: `Lua.type.checkTableShape`
Diffstat (limited to 'test/diagnostics')
-rw-r--r--test/diagnostics/cast-local-type.lua5
-rw-r--r--test/diagnostics/param-type-mismatch.lua7
2 files changed, 11 insertions, 1 deletions
diff --git a/test/diagnostics/cast-local-type.lua b/test/diagnostics/cast-local-type.lua
index 93452a92..d702adf3 100644
--- a/test/diagnostics/cast-local-type.lua
+++ b/test/diagnostics/cast-local-type.lua
@@ -1,3 +1,4 @@
+local config = require "config.config"
TEST [[
local x = 0
@@ -345,6 +346,8 @@ local v
v = a
]]
+config.set(nil, 'Lua.type.checkTableShape', true)
+
TEST [[
---@class A
---@field x string
@@ -398,3 +401,5 @@ local a = {x = "b", y = {}}
local v
<!v!> = a
]]
+
+config.set(nil, 'Lua.type.checkTableShape', false)
diff --git a/test/diagnostics/param-type-mismatch.lua b/test/diagnostics/param-type-mismatch.lua
index bb602cab..b75e9307 100644
--- a/test/diagnostics/param-type-mismatch.lua
+++ b/test/diagnostics/param-type-mismatch.lua
@@ -1,3 +1,4 @@
+local config = require "config.config"
TEST [[
---@param x number
local function f(x) end
@@ -278,6 +279,8 @@ function f(a) end
f(a)
]]
+config.set(nil, 'Lua.type.checkTableShape', true)
+
TEST [[
---@class A
---@field x string
@@ -347,4 +350,6 @@ local a = {}
function f(a) end
f(a)
-]] \ No newline at end of file
+]]
+
+config.set(nil, 'Lua.type.checkTableShape', false)