You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('should create aliasses for global enumerations',()=>{
153
+
constwriter=newGluaApiWriter();
154
+
constapi=writer.writePage(<Enum>{
155
+
type: 'enum',
156
+
name: 'MATERIAL_FOG',
157
+
address: 'Enums/MATERIAL_FOG',
158
+
description: 'The fog mode.',
159
+
realm: 'Client',
160
+
items: [
161
+
{
162
+
key: 'MATERIAL_FOG_NONE',
163
+
value: '0',
164
+
description: 'No fog',
165
+
},
166
+
{
167
+
key: 'MATERIAL_FOG_LINEAR',
168
+
value: '1',
169
+
description: 'Linear fog',
170
+
},
171
+
{
172
+
key: 'MATERIAL_FOG_LINEAR_BELOW_FOG_Z',
173
+
value: '2',
174
+
}
175
+
],
176
+
});
177
+
178
+
expect(api).toEqual(`---@alias MATERIAL_FOG 0|1|2\n--- No fog\nMATERIAL_FOG_NONE = 0\n--- Linear fog\nMATERIAL_FOG_LINEAR = 1\nMATERIAL_FOG_LINEAR_BELOW_FOG_Z = 2\n\n\n`);
179
+
});
180
+
181
+
it('should create enums for table enumerations',()=>{
182
+
constwriter=newGluaApiWriter();
183
+
constapi=writer.writePage(<Enum>{
184
+
type: 'enum',
185
+
name: 'SCREENFADE',
186
+
address: 'Enums/SCREENFADE',
187
+
description: 'The screen fade mode.',
188
+
realm: 'Client',
189
+
items: [
190
+
{
191
+
key: '',
192
+
value: '0',
193
+
description: 'Instant fade in',
194
+
},
195
+
{
196
+
key: 'SCREENFADE.IN',
197
+
value: '1',
198
+
description: 'Instant fade in',
199
+
},
200
+
{
201
+
key: 'SCREENFADE.OUT',
202
+
value: '2',
203
+
description: 'Slowly fade in',
204
+
},
205
+
{
206
+
key: 'SCREENFADE.MODULATE',
207
+
value: '4',
208
+
},
209
+
{
210
+
key: 'SCREENFADE.STAYOUT',
211
+
value: '8',
212
+
description: 'Never disappear',
213
+
},
214
+
{
215
+
key: 'SCREENFADE.PURGE',
216
+
value: '16',
217
+
description: 'Used to purge all currently active screen fade effects...\nMultiple\nLines',
218
+
},
219
+
],
220
+
});
221
+
222
+
expect(api).toEqual(`---@enum SCREENFADE\n--- The screen fade mode.\nSCREENFADE = {\n --- Instant fade in\n IN = 1,\n --- Slowly fade in\n OUT = 2,\n MODULATE = 4,\n --- Never disappear\n STAYOUT = 8,\n --- Used to purge all currently active screen fade effects...\n --- Multiple\n --- Lines\n PURGE = 16,\n}\n\n`);
223
+
});
224
+
152
225
it('should convert table<type> to type[]',()=>{
153
226
constwriter=newGluaApiWriter();
154
227
constapi=writer.writePage(<LibraryFunction>{
@@ -319,6 +392,32 @@ describe('GLua API Writer', () => {
319
392
expect(api).toEqual(`---[CLIENT] Returns where on the screen the specified position vector would appear.\n---\n---[(View on wiki)](na)\n---@return ToScreenData # The created Structures/ToScreenData.\nfunction Vector.ToScreen() end\n\n`);
320
393
});
321
394
395
+
// number{ENUM_NAME} -> ENUM_NAME
396
+
it('should support enum type',()=>{
397
+
constwriter=newGluaApiWriter();
398
+
constapi=writer.writePage(<LibraryFunction>{
399
+
name: 'FogMode',
400
+
address: 'render.FogMode',
401
+
parent: 'render',
402
+
dontDefineParent: true,
403
+
description: 'Sets the fog mode.',
404
+
realm: 'Client',
405
+
type: 'libraryfunc',
406
+
url: 'na',
407
+
arguments: [
408
+
{
409
+
args: [{
410
+
name: 'mode',
411
+
type: 'number{MATERIAL_FOG}',
412
+
description: 'The fog mode.',
413
+
}]
414
+
}
415
+
],
416
+
});
417
+
418
+
expect(api).toEqual(`---[CLIENT] Sets the fog mode.\n---\n---[(View on wiki)](na)\n---@param mode MATERIAL_FOG The fog mode.\nfunction render.FogMode(mode) end\n\n`);
419
+
});
420
+
322
421
// it('should be able to write Annotated API files directly from wiki pages', async () => {
0 commit comments