summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-03 20:57:19 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-03 20:57:19 +0800
commit66c33f2ba3d6cb19434318b496b982d930a18159 (patch)
treee608bdb46d2e1a83880f4cebc356a83261d7eb18 /server/test
parent1a78d51e0580bfb19d07353bc7228bad37639839 (diff)
downloadlua-language-server-66c33f2ba3d6cb19434318b496b982d930a18159.zip
修正bug
Diffstat (limited to 'server/test')
-rw-r--r--server/test/definition/bug.lua9
-rw-r--r--server/test/definition/init.lua4
2 files changed, 12 insertions, 1 deletions
diff --git a/server/test/definition/bug.lua b/server/test/definition/bug.lua
index a6214425..0386a1d3 100644
--- a/server/test/definition/bug.lua
+++ b/server/test/definition/bug.lua
@@ -43,3 +43,12 @@ io.load(root / <?args?>.source / 'API' / path)
TEST [[
obj[#<?obj?>+1] = {}
]]
+
+TEST [[
+self = {
+ results = {
+ <!labels!> = {},
+ }
+}
+self[self.results.<?labels?>] = lbl
+]]
diff --git a/server/test/definition/init.lua b/server/test/definition/init.lua
index 435ab2f8..e5dccd4f 100644
--- a/server/test/definition/init.lua
+++ b/server/test/definition/init.lua
@@ -41,7 +41,9 @@ end
function TEST(script)
local target = catch_target(script)
- local pos = script:find('<?', 1, true) + 2
+ local start = script:find('<?', 1, true)
+ local finish = script:find('?>', 1, true)
+ local pos = (start + finish) // 2 + 1
local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ')
local ast, err = parser:ast(new_script)
assert(ast)