Skip to content

Commit 5129a36

Browse files
feat(luassert): Add luassert annotation types (#552)
1 parent f592187 commit 5129a36

File tree

5 files changed

+388
-1
lines changed

5 files changed

+388
-1
lines changed

.styluaignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ lua/luassert
44
lua/plenary/profile.lua
55
lua/plenary/profile/
66
lua/plenary/bit.lua
7+
lua/plenary/_meta/_luassert.lua
78
lua/say.lua
89
scratch/
910
scripts/
10-

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ test:
55
generate_filetypes:
66
nvim --headless -c 'luafile scripts/update_filetypes_from_github.lua' -c 'qa!'
77

8+
generate_luassert_types:
9+
nvim --headless -c 'luafile scripts/generate_luassert_types.lua' -c 'qa!'
10+
811
lint:
912
luacheck lua/plenary

lua/plenary/_meta/_luassert.lua

Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
---@meta
2+
---This file is autogenerated, DO NOT EDIT
3+
error "Cannot require a meta file"
4+
5+
---@generic T:any
6+
---@alias LuassertFunction fun(value:T, message?:string):T
7+
---@alias LuassertFunctionTwoArgs fun(expected:T, actual:T, message?:string):T
8+
---@alias LuassertFunctionMultiArgs fun(...:T):T
9+
10+
---@class Luassert
11+
---@field are_boolean LuassertFunction
12+
---@field are_equal LuassertFunctionTwoArgs
13+
---@field are_equals LuassertFunctionTwoArgs
14+
---@field are_error LuassertFunction
15+
---@field are_error_match LuassertFunctionTwoArgs
16+
---@field are_error_matches LuassertFunctionTwoArgs
17+
---@field are_errors LuassertFunction
18+
---@field are_false LuassertFunction
19+
---@field are_falsy LuassertFunction
20+
---@field are_function LuassertFunction
21+
---@field are_holes LuassertFunction
22+
---@field are_match LuassertFunctionTwoArgs
23+
---@field are_match_error LuassertFunctionTwoArgs
24+
---@field are_matches LuassertFunctionTwoArgs
25+
---@field are_matches_error LuassertFunctionTwoArgs
26+
---@field are_near LuassertFunctionMultiArgs
27+
---@field are_nil LuassertFunction
28+
---@field are_number LuassertFunction
29+
---@field are_returned_arguments LuassertFunction
30+
---@field are_same LuassertFunctionTwoArgs
31+
---@field are_string LuassertFunction
32+
---@field are_table LuassertFunction
33+
---@field are_thread LuassertFunction
34+
---@field are_true LuassertFunction
35+
---@field are_truthy LuassertFunction
36+
---@field are_unique LuassertFunction
37+
---@field are_userdata LuassertFunction
38+
---@field array_boolean LuassertFunction
39+
---@field array_equal LuassertFunctionTwoArgs
40+
---@field array_equals LuassertFunctionTwoArgs
41+
---@field array_error LuassertFunction
42+
---@field array_error_match LuassertFunctionTwoArgs
43+
---@field array_error_matches LuassertFunctionTwoArgs
44+
---@field array_errors LuassertFunction
45+
---@field array_false LuassertFunction
46+
---@field array_falsy LuassertFunction
47+
---@field array_function LuassertFunction
48+
---@field array_holes LuassertFunction
49+
---@field array_match LuassertFunctionTwoArgs
50+
---@field array_match_error LuassertFunctionTwoArgs
51+
---@field array_matches LuassertFunctionTwoArgs
52+
---@field array_matches_error LuassertFunctionTwoArgs
53+
---@field array_near LuassertFunctionMultiArgs
54+
---@field array_nil LuassertFunction
55+
---@field array_number LuassertFunction
56+
---@field array_returned_arguments LuassertFunction
57+
---@field array_same LuassertFunctionTwoArgs
58+
---@field array_string LuassertFunction
59+
---@field array_table LuassertFunction
60+
---@field array_thread LuassertFunction
61+
---@field array_true LuassertFunction
62+
---@field array_truthy LuassertFunction
63+
---@field array_unique LuassertFunction
64+
---@field array_userdata LuassertFunction
65+
---@field does_boolean LuassertFunction
66+
---@field does_equal LuassertFunctionTwoArgs
67+
---@field does_equals LuassertFunctionTwoArgs
68+
---@field does_error LuassertFunction
69+
---@field does_error_match LuassertFunctionTwoArgs
70+
---@field does_error_matches LuassertFunctionTwoArgs
71+
---@field does_errors LuassertFunction
72+
---@field does_false LuassertFunction
73+
---@field does_falsy LuassertFunction
74+
---@field does_function LuassertFunction
75+
---@field does_holes LuassertFunction
76+
---@field does_match LuassertFunctionTwoArgs
77+
---@field does_match_error LuassertFunctionTwoArgs
78+
---@field does_matches LuassertFunctionTwoArgs
79+
---@field does_matches_error LuassertFunctionTwoArgs
80+
---@field does_near LuassertFunctionMultiArgs
81+
---@field does_nil LuassertFunction
82+
---@field does_number LuassertFunction
83+
---@field does_returned_arguments LuassertFunction
84+
---@field does_same LuassertFunctionTwoArgs
85+
---@field does_string LuassertFunction
86+
---@field does_table LuassertFunction
87+
---@field does_thread LuassertFunction
88+
---@field does_true LuassertFunction
89+
---@field does_truthy LuassertFunction
90+
---@field does_unique LuassertFunction
91+
---@field does_userdata LuassertFunction
92+
---@field has_boolean LuassertFunction
93+
---@field has_equal LuassertFunctionTwoArgs
94+
---@field has_equals LuassertFunctionTwoArgs
95+
---@field has_error LuassertFunction
96+
---@field has_error_match LuassertFunctionTwoArgs
97+
---@field has_error_matches LuassertFunctionTwoArgs
98+
---@field has_errors LuassertFunction
99+
---@field has_false LuassertFunction
100+
---@field has_falsy LuassertFunction
101+
---@field has_function LuassertFunction
102+
---@field has_holes LuassertFunction
103+
---@field has_match LuassertFunctionTwoArgs
104+
---@field has_match_error LuassertFunctionTwoArgs
105+
---@field has_matches LuassertFunctionTwoArgs
106+
---@field has_matches_error LuassertFunctionTwoArgs
107+
---@field has_near LuassertFunctionMultiArgs
108+
---@field has_nil LuassertFunction
109+
---@field has_number LuassertFunction
110+
---@field has_returned_arguments LuassertFunction
111+
---@field has_same LuassertFunctionTwoArgs
112+
---@field has_string LuassertFunction
113+
---@field has_table LuassertFunction
114+
---@field has_thread LuassertFunction
115+
---@field has_true LuassertFunction
116+
---@field has_truthy LuassertFunction
117+
---@field has_unique LuassertFunction
118+
---@field has_userdata LuassertFunction
119+
---@field is_boolean LuassertFunction
120+
---@field is_equal LuassertFunctionTwoArgs
121+
---@field is_equals LuassertFunctionTwoArgs
122+
---@field is_error LuassertFunction
123+
---@field is_error_match LuassertFunctionTwoArgs
124+
---@field is_error_matches LuassertFunctionTwoArgs
125+
---@field is_errors LuassertFunction
126+
---@field is_false LuassertFunction
127+
---@field is_falsy LuassertFunction
128+
---@field is_function LuassertFunction
129+
---@field is_holes LuassertFunction
130+
---@field is_match LuassertFunctionTwoArgs
131+
---@field is_match_error LuassertFunctionTwoArgs
132+
---@field is_matches LuassertFunctionTwoArgs
133+
---@field is_matches_error LuassertFunctionTwoArgs
134+
---@field is_near LuassertFunctionMultiArgs
135+
---@field is_nil LuassertFunction
136+
---@field is_number LuassertFunction
137+
---@field is_returned_arguments LuassertFunction
138+
---@field is_same LuassertFunctionTwoArgs
139+
---@field is_string LuassertFunction
140+
---@field is_table LuassertFunction
141+
---@field is_thread LuassertFunction
142+
---@field is_true LuassertFunction
143+
---@field is_truthy LuassertFunction
144+
---@field is_unique LuassertFunction
145+
---@field is_userdata LuassertFunction
146+
---@field message_boolean LuassertFunction
147+
---@field message_equal LuassertFunctionTwoArgs
148+
---@field message_equals LuassertFunctionTwoArgs
149+
---@field message_error LuassertFunction
150+
---@field message_error_match LuassertFunctionTwoArgs
151+
---@field message_error_matches LuassertFunctionTwoArgs
152+
---@field message_errors LuassertFunction
153+
---@field message_false LuassertFunction
154+
---@field message_falsy LuassertFunction
155+
---@field message_function LuassertFunction
156+
---@field message_holes LuassertFunction
157+
---@field message_match LuassertFunctionTwoArgs
158+
---@field message_match_error LuassertFunctionTwoArgs
159+
---@field message_matches LuassertFunctionTwoArgs
160+
---@field message_matches_error LuassertFunctionTwoArgs
161+
---@field message_near LuassertFunctionMultiArgs
162+
---@field message_nil LuassertFunction
163+
---@field message_number LuassertFunction
164+
---@field message_returned_arguments LuassertFunction
165+
---@field message_same LuassertFunctionTwoArgs
166+
---@field message_string LuassertFunction
167+
---@field message_table LuassertFunction
168+
---@field message_thread LuassertFunction
169+
---@field message_true LuassertFunction
170+
---@field message_truthy LuassertFunction
171+
---@field message_unique LuassertFunction
172+
---@field message_userdata LuassertFunction
173+
---@field no_boolean LuassertFunction
174+
---@field no_equal LuassertFunctionTwoArgs
175+
---@field no_equals LuassertFunctionTwoArgs
176+
---@field no_error LuassertFunction
177+
---@field no_error_match LuassertFunctionTwoArgs
178+
---@field no_error_matches LuassertFunctionTwoArgs
179+
---@field no_errors LuassertFunction
180+
---@field no_false LuassertFunction
181+
---@field no_falsy LuassertFunction
182+
---@field no_function LuassertFunction
183+
---@field no_holes LuassertFunction
184+
---@field no_match LuassertFunctionTwoArgs
185+
---@field no_match_error LuassertFunctionTwoArgs
186+
---@field no_matches LuassertFunctionTwoArgs
187+
---@field no_matches_error LuassertFunctionTwoArgs
188+
---@field no_near LuassertFunctionMultiArgs
189+
---@field no_nil LuassertFunction
190+
---@field no_number LuassertFunction
191+
---@field no_returned_arguments LuassertFunction
192+
---@field no_same LuassertFunctionTwoArgs
193+
---@field no_string LuassertFunction
194+
---@field no_table LuassertFunction
195+
---@field no_thread LuassertFunction
196+
---@field no_true LuassertFunction
197+
---@field no_truthy LuassertFunction
198+
---@field no_unique LuassertFunction
199+
---@field no_userdata LuassertFunction
200+
---@field not_boolean LuassertFunction
201+
---@field not_equal LuassertFunctionTwoArgs
202+
---@field not_equals LuassertFunctionTwoArgs
203+
---@field not_error LuassertFunction
204+
---@field not_error_match LuassertFunctionTwoArgs
205+
---@field not_error_matches LuassertFunctionTwoArgs
206+
---@field not_errors LuassertFunction
207+
---@field not_false LuassertFunction
208+
---@field not_falsy LuassertFunction
209+
---@field not_function LuassertFunction
210+
---@field not_holes LuassertFunction
211+
---@field not_match LuassertFunctionTwoArgs
212+
---@field not_match_error LuassertFunctionTwoArgs
213+
---@field not_matches LuassertFunctionTwoArgs
214+
---@field not_matches_error LuassertFunctionTwoArgs
215+
---@field not_near LuassertFunctionMultiArgs
216+
---@field not_nil LuassertFunction
217+
---@field not_number LuassertFunction
218+
---@field not_returned_arguments LuassertFunction
219+
---@field not_same LuassertFunctionTwoArgs
220+
---@field not_string LuassertFunction
221+
---@field not_table LuassertFunction
222+
---@field not_thread LuassertFunction
223+
---@field not_true LuassertFunction
224+
---@field not_truthy LuassertFunction
225+
---@field not_unique LuassertFunction
226+
---@field not_userdata LuassertFunction
227+
---@field was_boolean LuassertFunction
228+
---@field was_equal LuassertFunctionTwoArgs
229+
---@field was_equals LuassertFunctionTwoArgs
230+
---@field was_error LuassertFunction
231+
---@field was_error_match LuassertFunctionTwoArgs
232+
---@field was_error_matches LuassertFunctionTwoArgs
233+
---@field was_errors LuassertFunction
234+
---@field was_false LuassertFunction
235+
---@field was_falsy LuassertFunction
236+
---@field was_function LuassertFunction
237+
---@field was_holes LuassertFunction
238+
---@field was_match LuassertFunctionTwoArgs
239+
---@field was_match_error LuassertFunctionTwoArgs
240+
---@field was_matches LuassertFunctionTwoArgs
241+
---@field was_matches_error LuassertFunctionTwoArgs
242+
---@field was_near LuassertFunctionMultiArgs
243+
---@field was_nil LuassertFunction
244+
---@field was_number LuassertFunction
245+
---@field was_returned_arguments LuassertFunction
246+
---@field was_same LuassertFunctionTwoArgs
247+
---@field was_string LuassertFunction
248+
---@field was_table LuassertFunction
249+
---@field was_thread LuassertFunction
250+
---@field was_true LuassertFunction
251+
---@field was_truthy LuassertFunction
252+
---@field was_unique LuassertFunction
253+
---@field was_userdata LuassertFunction
254+
---@field boolean LuassertFunction
255+
---@field equal LuassertFunctionTwoArgs
256+
---@field equals LuassertFunctionTwoArgs
257+
---@field error LuassertFunction
258+
---@field error_match LuassertFunctionTwoArgs
259+
---@field error_matches LuassertFunctionTwoArgs
260+
---@field errors LuassertFunction
261+
---@field False LuassertFunction
262+
---@field falsy LuassertFunction
263+
---@field Function LuassertFunction
264+
---@field holes LuassertFunction
265+
---@field match LuassertFunctionTwoArgs
266+
---@field match_error LuassertFunctionTwoArgs
267+
---@field matches LuassertFunctionTwoArgs
268+
---@field matches_error LuassertFunctionTwoArgs
269+
---@field near LuassertFunctionMultiArgs
270+
---@field Nil LuassertFunction
271+
---@field number LuassertFunction
272+
---@field returned_arguments LuassertFunction
273+
---@field same LuassertFunctionTwoArgs
274+
---@field string LuassertFunction
275+
---@field table LuassertFunction
276+
---@field thread LuassertFunction
277+
---@field True LuassertFunction
278+
---@field truthy LuassertFunction
279+
---@field unique LuassertFunction
280+
---@field userdata LuassertFunction
281+
---@field are Luassert
282+
---@field array Luassert
283+
---@field does Luassert
284+
---@field has Luassert
285+
---@field is Luassert
286+
---@field message Luassert
287+
---@field no Luassert
288+
---@field Not Luassert
289+
---@field was Luassert

lua/plenary/busted.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ pending = mod.pending
212212
before_each = mod.before_each
213213
after_each = mod.after_each
214214
clear = mod.clear
215+
---@type Luassert
215216
assert = require "luassert"
216217

217218
mod.run = function(file)

0 commit comments

Comments
 (0)