summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/completion/common.lua2
-rw-r--r--test/crossfile/references.lua14
-rw-r--r--test/references/all.lua16
-rw-r--r--test/references/common.lua66
-rw-r--r--test/references/init.lua4
5 files changed, 52 insertions, 50 deletions
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 0d00ddf9..292a2dca 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -1921,6 +1921,7 @@ vvv<??>
},
}
+--[=[
Cared['insertText'] = true
TEST [[
---@param callback fun(x: number, y: number):string
@@ -1944,6 +1945,7 @@ end\
```"
},
}
+]=]
Cared['insertText'] = nil
diff --git a/test/crossfile/references.lua b/test/crossfile/references.lua
index 5ab6a18f..1a9f2508 100644
--- a/test/crossfile/references.lua
+++ b/test/crossfile/references.lua
@@ -103,7 +103,7 @@ TEST {
{
path = 'a.lua',
content = [[
- ROOT = 1
+ <!ROOT!> = 1
]],
},
{
@@ -118,7 +118,7 @@ TEST {
{
path = 'a.lua',
content = [[
- <?ROOT?> = 1
+ <~ROOT~> = 1
]],
},
{
@@ -145,7 +145,7 @@ TEST {
---@class A
local mt
- function mt.<?f?>()
+ function mt.<~f~>()
end
]]
}
@@ -156,7 +156,7 @@ TEST {
path = 'a.lua',
content = [[
local t = {}
- t.<?x?> = 1
+ t.<~x~> = 1
return t
]]
},
@@ -192,7 +192,7 @@ TEST {
path = 'a.lua',
content = [[
local m = {}
- function m.<?func?>()
+ function m.<~func~>()
end
return m
]],
@@ -244,7 +244,7 @@ TEST {
{
path = 'a.lua',
content = [[
- local function <?f?>()
+ local function <~f~>()
end
return {
@@ -361,7 +361,7 @@ TEST {
{
path = 'a.lua',
content = [[
- local <?t?> = require 'b'
+ local <~t~> = require 'b'
return <!t!>
]]
},
diff --git a/test/references/all.lua b/test/references/all.lua
index 235e67fd..9395df86 100644
--- a/test/references/all.lua
+++ b/test/references/all.lua
@@ -3,7 +3,7 @@ local config = require 'config'
TEST [[
---@class A
local a = {}
-a.<?x?> = 1
+a.<~x~> = 1
---@return A
local function f() end
@@ -15,7 +15,7 @@ return b.<!x!>
TEST [[
---@class A
local a = {}
-a.<?x?> = 1
+a.<~x~> = 1
---@return table
---@return A
@@ -26,7 +26,7 @@ return a.x, b.<!x!>
]]
TEST [[
-local <?mt?> = {}
+local <~mt~> = {}
function <!mt!>:x()
self:x()
end
@@ -34,7 +34,7 @@ end
TEST [[
local mt = {}
-function mt:<?x?>()
+function mt:<~x~>()
self:<!x!>()
end
]]
@@ -42,7 +42,7 @@ end
--TEST [[
-----@class Dog
--local mt = {}
---function mt:<?eat?>()
+--function mt:<~eat~>()
--end
--
-----@class Master
@@ -86,13 +86,13 @@ TEST [[
local t
---@class B: A
-local <?v?>
+local <~v~>
]]
TEST [[
---@class Dog
local Dog = {}
-function Dog:<?eat?>()
+function Dog:<~eat~>()
end
---@generic T
@@ -109,7 +109,7 @@ v1:<!eat!>()
TEST [[
---@class Dog
local Dog = {}
-function Dog:<?eat?>()
+function Dog:<~eat~>()
end
---@class Master
diff --git a/test/references/common.lua b/test/references/common.lua
index 74ce391a..5217200d 100644
--- a/test/references/common.lua
+++ b/test/references/common.lua
@@ -1,35 +1,35 @@
local config = require "config"
TEST [[
-local <?a?> = 1
+local <~a~> = 1
<!a!> = <!a!>
]]
TEST [[
-<?a?> = 1
-a = <!a!>
+<~a~> = 1
+<!a!> = <!a!>
]]
TEST [[
local t
-t.<?a?> = 1
-t.a = t.<!a!>
+t.<~a~> = 1
+t.<!a!> = t.<!a!>
]]
TEST [[
-t.<?a?> = 1
-t.a = t.<!a!>
+t.<~a~> = 1
+t.<!a!> = t.<!a!>
]]
TEST [[
:: <!LABEL!> ::
-goto <!<?LABEL?>!>
+goto <~LABEL~>
if true then
goto <!LABEL!>
end
]]
TEST [[
-:: <!<?LABEL?>!> ::
+:: <~LABEL~> ::
goto <!LABEL!>
if true then
goto <!LABEL!>
@@ -38,75 +38,75 @@ end
TEST [[
local a = 1
-local <?a?> = 1
+local <~a~> = 1
<!a!> = <!a!>
]]
TEST [[
-local <?a?>
+local <~a~>
local b = <!a!>
]]
TEST [[
local t = {
- <?a?> = 1
+ <~a~> = 1
}
print(t.<!a!>)
]]
TEST [[
-t[<?'a'?>] = 1
+t[<~'a'~>] = 1
print(t.<!a!>)
]]
TEST [[
local t = {
- [<?'a'?>] = 1
+ [<~'a'~>] = 1
}
print(t.<!a!>)
]]
TEST [[
table.<!dump!>()
-function table.<?dump?>()
+function table.<~dump~>()
end
]]
TEST [[
local t = {}
-t.<?x?> = 1
+t.<~x~> = 1
t[a.b.c] = 1
]]
TEST [[
local t = {}
t.x = 1
-t[a.b.<!<?x?>!>] = 1
+t[a.b.<~x~>] = 1
]]
TEST [[
self = {
results = {
- <?labels?> = {},
+ <~labels~> = {},
}
}
self[self.results.<!labels!>] = lbl
]]
TEST [[
-a.b.<?c?> = 1
+a.b.<~c~> = 1
print(a.b.<!c!>)
]]
TEST [[
-local mt = {}
+local <!mt!> = {}
function mt:x()
- <!<?self?>!>:x()
+ <~self~>:x()
end
]]
TEST [[
-local <?mt?> = {}
+local <~mt~> = {}
function <!mt!>:x()
self:x()
end
@@ -114,38 +114,38 @@ end
TEST [[
local mt = {}
-function mt:x()
- self:<!<?x?>!>()
+function mt:<!x!>()
+ self:<~x~>()
end
]]
TEST [[
local mt = {}
-function mt:<?x?>()
+function mt:<~x~>()
self:<!x!>()
end
]]
TEST [[
a.<!b!>.c = 1
-print(a.<!<?b?>!>.c)
+print(a.<~b~>.c)
]]
TEST [[
-_G.<?xxx?> = 1
+_G.<~xxx~> = 1
print(<!xxx!>)
]]
TEST [[
----@class <?Class?>
+---@class <~Class~>
---@type <!Class!>
---@type <!Class!>
]]
TEST [[
---@class Class
-local <?t?>
+local <~t~>
---@type Class
local x
]]
@@ -154,12 +154,12 @@ TEST [[
---@class Class
local t
---@type Class
-local <?x?>
+local <~x~>
]]
-- BUG
TEST [[
----@return <!<?xxx?>!>
+---@return <~xxx~>
function f() end
]]
@@ -168,7 +168,7 @@ TEST [[
---@class B: A
---@type A
-local <?t?>
+local <~t~>
]]
--TEST [[
@@ -181,6 +181,6 @@ local <?t?>
-----@type A
--local c
--
---b.<?x?> = 1
+--b.<~x~> = 1
--c.<!x!> = 1
--]]
diff --git a/test/references/init.lua b/test/references/init.lua
index c8391769..1b1cc73b 100644
--- a/test/references/init.lua
+++ b/test/references/init.lua
@@ -23,8 +23,8 @@ function TEST(script)
local newScript, catched = catch(script, '!?~')
files.setText('', newScript)
- local input = catched['?']
- local expect = catched['!']
+ local input = catched['?'] + catched['~']
+ local expect = catched['!'] + catched['~']
local results = core('', input[1][1])
if results then
local positions = {}