summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-16 15:55:33 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-16 15:55:33 +0800
commit776d25a2e68b86c2ac37357a71abcd4f2787498b (patch)
treecbd11fbb1a3eb551fa3ed4b3d9f38edec7487ce2 /test
parenta656626742e3a475731a4d27e0a7f9292ecbaa22 (diff)
downloadlua-language-server-776d25a2e68b86c2ac37357a71abcd4f2787498b.zip
stash
Diffstat (limited to 'test')
-rw-r--r--test/basic/linker.lua50
-rw-r--r--test/references/init.lua6
2 files changed, 26 insertions, 30 deletions
diff --git a/test/basic/linker.lua b/test/basic/linker.lua
index 3b18ddc9..dd097dfe 100644
--- a/test/basic/linker.lua
+++ b/test/basic/linker.lua
@@ -45,83 +45,79 @@ local function TEST(script)
end
CARE['id'] = true
-CARE['loc'] = true
TEST [[
local <?x?>
]] {
- id = '9',
- loc = true,
+ id = 'l:9',
}
TEST [[
local x
print(<?x?>)
]] {
- id = '7',
- loc = true,
+ id = '7',
+ mode = 'local',
}
TEST [[
local x
<?x?> = 1
]] {
- id = '7',
- loc = true,
+ id = '7',
+ mode = 'local',
}
-CARE['global'] = true
TEST [[
print(<?X?>)
]] {
- id = '"X"',
- global = true,
+ id = '"X"',
+ mode = 'global',
}
TEST [[
print(<?X?>)
]] {
- id = '"X"',
- global = true,
+ id = '"X"',
+ mode = 'global',
}
TEST [[
local x
print(x.y.<?z?>)
]] {
- id = '7|"y"|"z"',
- loc = true,
+ id = '7|"y"|"z"',
+ mode = 'local',
}
TEST [[
local x
function x:<?f?>() end
]] {
- id = '7|"f"',
- loc = true,
+ id = '7|"f"',
+ mode = 'local',
}
TEST [[
print(X.Y.<?Z?>)
]] {
- id = '"X"|"Y"|"Z"',
- global = true,
+ id = '"X"|"Y"|"Z"',
+ mode = 'global',
}
TEST [[
function x:<?f?>() end
]] {
- id = '"x"|"f"',
- global = true,
+ id = '"x"|"f"',
+ mode = 'global',
}
-CARE['tfield'] = true
TEST [[
{
<?x?> = 1,
}
]] {
- id = '1|"x"',
- tfield = true,
+ id = '1|"x"',
+ mode = 'table',
}
CARE['freturn'] = true
@@ -129,7 +125,7 @@ TEST [[
return <?X?>
]] {
id = '"X"',
- global = true,
+ mode = 'global',
freturn = 0,
}
@@ -139,7 +135,7 @@ function f()
end
]] {
id = '"X"',
- global = true,
+ mode = 'global',
freturn = 1,
}
@@ -148,7 +144,7 @@ TEST [[
goto label
]] {
id = '5',
- loc = true,
+ mode = 'local',
}
TEST [[
@@ -156,5 +152,5 @@ TEST [[
goto <?label?>
]] {
id = '3',
- loc = true,
+ mode = 'local',
}
diff --git a/test/references/init.lua b/test/references/init.lua
index e24694d2..66e002a2 100644
--- a/test/references/init.lua
+++ b/test/references/init.lua
@@ -33,7 +33,7 @@ end
function TEST(script)
files.removeAll()
- local target = catch_target(script)
+ local expect = catch_target(script)
local start = script:find('<[?~]')
local finish = script:find('[?~]>')
local pos = (start + finish) // 2 + 1
@@ -46,9 +46,9 @@ function TEST(script)
for i, result in ipairs(results) do
positions[i] = { result.target.start, result.target.finish }
end
- assert(founded(target, positions))
+ assert(founded(expect, positions))
else
- assert(#target == 0)
+ assert(#expect == 0)
end
end