summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-11-30 15:23:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-11-30 15:23:18 +0800
commit71a267d42d6a28dcf1333092d57714f274fc698d (patch)
tree29f4d0dff2d052d3c94c5b6bf7cf42de4bbcc646 /server/test
parent24243540681b97956ef29a6bec9d94a6f1dc5208 (diff)
downloadlua-language-server-71a267d42d6a28dcf1333092d57714f274fc698d.zip
支持向后引用
Diffstat (limited to 'server/test')
-rw-r--r--server/test/definition/arg.lua3
-rw-r--r--server/test/definition/bug.lua3
-rw-r--r--server/test/definition/init.lua8
-rw-r--r--server/test/definition/table.lua2
4 files changed, 11 insertions, 5 deletions
diff --git a/server/test/definition/arg.lua b/server/test/definition/arg.lua
index 83afb04f..9dc91f2d 100644
--- a/server/test/definition/arg.lua
+++ b/server/test/definition/arg.lua
@@ -11,7 +11,8 @@ end
]]
TEST [[
-function <!mt!>:x()
+local <!mt!>
+function mt:x()
<?self?>()
end
]]
diff --git a/server/test/definition/bug.lua b/server/test/definition/bug.lua
index 7019e079..eeca98da 100644
--- a/server/test/definition/bug.lua
+++ b/server/test/definition/bug.lua
@@ -15,7 +15,8 @@ end
]]
TEST [[
-function <!a!>:b()
+local <!a!>
+function a:b()
a:b()
<?self?>()
end
diff --git a/server/test/definition/init.lua b/server/test/definition/init.lua
index de503c81..c13f1fb1 100644
--- a/server/test/definition/init.lua
+++ b/server/test/definition/init.lua
@@ -47,8 +47,12 @@ function TEST(script)
assert(ast)
local suc, result = matcher.definition(ast, pos)
- assert(suc)
- assert(founded(target, result))
+ if suc then
+ assert(suc)
+ assert(founded(target, result))
+ else
+ assert(#target == 0)
+ end
end
require 'definition.set'
diff --git a/server/test/definition/table.lua b/server/test/definition/table.lua
index 398abc80..3f23ed3a 100644
--- a/server/test/definition/table.lua
+++ b/server/test/definition/table.lua
@@ -65,7 +65,7 @@ t[<?'x'?>]()
TEST [[
local t
-t.<!a!>.b = 1
+t.<!a!> = 1
t.<?a?>.b()
]]