Skip to content

Commit 5e5a1b2

Browse files
committed
cleanup tests
1 parent cd37022 commit 5e5a1b2

23 files changed

+865
-865
lines changed

test/crossfile/diagnostic.lua

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,26 @@ function TEST(datas)
5858

5959

6060
local results = {}
61+
local origins = {}
6162
for _, data in ipairs(datas) do
6263
local uri = furi.encode(data.path)
6364
core(uri, false, function (result)
64-
results[#results+1] = {
65-
result.start,
66-
result.finish,
67-
uri,
68-
}
65+
if result.code == datas.code then
66+
results[#results+1] = {
67+
result.start,
68+
result.finish,
69+
uri,
70+
}
71+
end
72+
origins[#origins+1] = result
6973
end)
7074
end
75+
assert(datas.code, 'Need code')
7176
assert(founded(targetList, results))
7277
end
7378

7479
TEST {
80+
code = 'different-requires',
7581
{
7682
path = 'f/a.lua',
7783
content = '',
@@ -87,6 +93,7 @@ TEST {
8793
}
8894

8995
TEST {
96+
code = 'different-requires',
9097
{
9198
path = 'f/a.lua',
9299
content = '',
@@ -106,6 +113,7 @@ TEST {
106113
}
107114

108115
TEST {
116+
code = 'different-requires',
109117
{
110118
path = 'a.lua',
111119
content = '',
@@ -125,6 +133,7 @@ TEST {
125133
}
126134

127135
TEST {
136+
code = 'different-requires',
128137
{
129138
path = 'a/init.lua',
130139
content = '',
@@ -144,6 +153,7 @@ TEST {
144153
}
145154

146155
TEST {
156+
code = 'invisible',
147157
{ path = 'a.lua', content = [[
148158
---@class A
149159
---@field package x string
@@ -156,6 +166,7 @@ TEST {
156166
}
157167

158168
TEST {
169+
code = 'invisible',
159170
{ path = 'a.lua', content = [[
160171
---@class A
161172
---@field package x string
@@ -169,6 +180,7 @@ TEST {
169180
}
170181

171182
TEST {
183+
code = 'duplicate-doc-field',
172184
{ path = 'a.lua', content = [[
173185
---@class A
174186
---@field <!x!> number
@@ -180,6 +192,7 @@ TEST {
180192
}
181193

182194
TEST {
195+
code = 'duplicate-set-field',
183196
{ path = 'a.lua', content = [[
184197
---@class A
185198
local mt
@@ -197,6 +210,7 @@ TEST {
197210
}
198211

199212
TEST {
213+
code = 'duplicate-set-field',
200214
{ path = 'a.lua', content = [[
201215
---@class A
202216
local mt

test/diagnostics/await-in-sync.lua

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -117,34 +117,6 @@ return function ()
117117
end
118118
]]
119119

120-
TEST [[
121-
---@param cb fun()
122-
local function f(cb)
123-
return cb
124-
end
125-
126-
---@async
127-
local function af()
128-
return nil
129-
end
130-
131-
f(<!af!>)
132-
]]
133-
134-
TEST [[
135-
---@param cb async fun()
136-
local function f(cb)
137-
return cb
138-
end
139-
140-
---@async
141-
local function af()
142-
return nil
143-
end
144-
145-
f(af)
146-
]]
147-
148120
TEST [[
149121
local function f(cb)
150122
cb()
@@ -158,24 +130,3 @@ end
158130
159131
return af
160132
]]
161-
162-
TEST [[
163-
local function f(cb)
164-
cb()
165-
end
166-
167-
---@async
168-
local function af()
169-
f(function () ---@async
170-
return nil
171-
end)
172-
end
173-
174-
return af
175-
]]
176-
177-
TEST [[
178-
local _ = type(function () ---@async
179-
return nil
180-
end)
181-
]]

test/diagnostics/close-non-object.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ local _ <close> = <!''!>
99
TEST [[
1010
local c <close> = <!(function () return 1 end)()!>
1111
]]
12+
13+
TEST [[
14+
---@type unknown
15+
local t
16+
17+
local _ <close> = t
18+
]]

0 commit comments

Comments
 (0)