summaryrefslogtreecommitdiff
path: root/test/diagnostics/init.lua
diff options
context:
space:
mode:
authorCr4xy <Cr4xy@Live.de>2021-10-25 20:46:00 +0200
committerCr4xy <Cr4xy@Live.de>2021-10-25 20:46:00 +0200
commita9f091bc6573fd7b82ef8591c0240f2011e1aee9 (patch)
treeb1aecae2b9cc2fb56c3353aec48b836f55bcb5fc /test/diagnostics/init.lua
parenta7102fa03eee98acb55265145f6c08b0c2dea158 (diff)
downloadlua-language-server-a9f091bc6573fd7b82ef8591c0240f2011e1aee9.zip
add tests for redundant-return
Diffstat (limited to 'test/diagnostics/init.lua')
-rw-r--r--test/diagnostics/init.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua
index c526560a..ab55cd92 100644
--- a/test/diagnostics/init.lua
+++ b/test/diagnostics/init.lua
@@ -1311,6 +1311,43 @@ end
local val = {}
location('uri', val)
]]
+
+-- redundant-return
+TEST [[
+local function f()
+ <!return!>
+end
+f()
+]]
+
+TEST [[
+local function f()
+ return nil
+end
+f()
+]]
+
+TEST [[
+local function f()
+ local function x()
+ <!return!>
+ end
+ x()
+ return true
+end
+f()
+]]
+
+TEST [[
+local function f()
+ local function x()
+ return true
+ end
+ return x()
+end
+f()
+]]
+
---TODO(arthur)
do return end