comment-parser 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jshintrc +11 -0
- package/README.md +89 -30
- package/index.js +232 -150
- package/package.json +8 -5
- package/tests/custom-parsers.spec.js +139 -0
- package/tests/parse.spec.js +261 -124
- package/tests/option-raw.spec.js +0 -154
- package/tests/parse-location.spec.js +0 -190
package/tests/parse.spec.js
CHANGED
|
@@ -2,78 +2,71 @@ var fs = require('fs');
|
|
|
2
2
|
var expect = require('chai').expect;
|
|
3
3
|
var parse = require('../index');
|
|
4
4
|
|
|
5
|
-
describe('
|
|
5
|
+
describe('Comment string parsing', function() {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Source lines numeration:
|
|
9
|
+
*
|
|
10
|
+
* 0 function() {
|
|
11
|
+
* 1 // source with comments
|
|
12
|
+
* 2 }
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
6
15
|
|
|
7
16
|
function parsed(func, opts) {
|
|
8
17
|
var str = func.toString();
|
|
9
18
|
return parse(str.slice(
|
|
10
19
|
str.indexOf('{') + 1,
|
|
11
20
|
str.lastIndexOf('}')
|
|
12
|
-
)
|
|
21
|
+
), opts);
|
|
13
22
|
}
|
|
14
23
|
|
|
15
|
-
it('should parse
|
|
16
|
-
expect(parsed(function(){
|
|
17
|
-
/** Description */
|
|
18
|
-
var a;
|
|
19
|
-
})[0].description)
|
|
20
|
-
.to.eq('Description');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should gracefully parse one-liner with tag', function() {
|
|
24
|
-
var p = parsed(function(){
|
|
25
|
-
/** @tag */
|
|
26
|
-
var a;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
expect(p[0].description)
|
|
30
|
-
.to.eq('');
|
|
31
|
-
|
|
32
|
-
expect(p[0].line)
|
|
33
|
-
.to.eq(0);
|
|
34
|
-
|
|
35
|
-
expect(p[0].tags.length)
|
|
36
|
-
.to.eq(1);
|
|
37
|
-
|
|
38
|
-
expect(p[0].tags[0].tag)
|
|
39
|
-
.to.eq('tag');
|
|
40
|
-
|
|
41
|
-
expect(p[0].tags[0].line)
|
|
42
|
-
.to.eq(0);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should parse simple doc block with description', function() {
|
|
24
|
+
it('should parse doc block with description', function() {
|
|
46
25
|
expect(parsed(function(){
|
|
47
26
|
/**
|
|
48
27
|
* Description
|
|
49
28
|
*/
|
|
50
|
-
})[0]
|
|
51
|
-
.to.
|
|
29
|
+
})[0])
|
|
30
|
+
.to.eql({
|
|
31
|
+
description : 'Description',
|
|
32
|
+
source : 'Description',
|
|
33
|
+
line : 1,
|
|
34
|
+
tags : []
|
|
35
|
+
});
|
|
52
36
|
});
|
|
53
37
|
|
|
54
|
-
it('should
|
|
38
|
+
it('should skip surrounding empty lines while preserving line numbers', function() {
|
|
55
39
|
expect(parsed(function(){
|
|
56
40
|
/**
|
|
41
|
+
*
|
|
42
|
+
*
|
|
57
43
|
* Description first line
|
|
58
44
|
*
|
|
59
45
|
* Description second line
|
|
46
|
+
*
|
|
60
47
|
*/
|
|
61
48
|
var a;
|
|
62
|
-
})[0]
|
|
63
|
-
.
|
|
49
|
+
})[0])
|
|
50
|
+
.eql({
|
|
51
|
+
description : 'Description first line\n\nDescription second line',
|
|
52
|
+
source : 'Description first line\n\nDescription second line',
|
|
53
|
+
line : 1,
|
|
54
|
+
tags : []
|
|
55
|
+
});
|
|
64
56
|
});
|
|
65
57
|
|
|
66
|
-
it('should
|
|
58
|
+
it('should skip empty blocks', function() {
|
|
59
|
+
|
|
67
60
|
expect(parsed(function(){
|
|
68
61
|
/**
|
|
69
|
-
*
|
|
62
|
+
*
|
|
70
63
|
*/
|
|
71
64
|
var a;
|
|
72
|
-
})
|
|
73
|
-
.to.eq(
|
|
65
|
+
}).length)
|
|
66
|
+
.to.eq(0);
|
|
74
67
|
});
|
|
75
68
|
|
|
76
|
-
it('should parse multiple
|
|
69
|
+
it('should parse multiple doc blocks', function() {
|
|
77
70
|
var p = parsed(function(){
|
|
78
71
|
/**
|
|
79
72
|
* Description first line
|
|
@@ -89,14 +82,37 @@ describe('Single comment string parsing', function() {
|
|
|
89
82
|
expect(p.length)
|
|
90
83
|
.to.eq(2);
|
|
91
84
|
|
|
92
|
-
expect(p[0]
|
|
93
|
-
.to.
|
|
85
|
+
expect(p[0])
|
|
86
|
+
.to.eql({
|
|
87
|
+
description : 'Description first line',
|
|
88
|
+
source : 'Description first line',
|
|
89
|
+
line : 1,
|
|
90
|
+
tags : []
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
expect(p[1])
|
|
94
|
+
.to.eql({
|
|
95
|
+
description : 'Description second line',
|
|
96
|
+
source : 'Description second line',
|
|
97
|
+
line : 6,
|
|
98
|
+
tags : []
|
|
99
|
+
});
|
|
100
|
+
});
|
|
94
101
|
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
it('should parse one line block', function() {
|
|
103
|
+
expect(parsed(function(){
|
|
104
|
+
/** Description */
|
|
105
|
+
var a;
|
|
106
|
+
})[0])
|
|
107
|
+
.to.eql({
|
|
108
|
+
description : 'Description',
|
|
109
|
+
source : 'Description',
|
|
110
|
+
line : 1,
|
|
111
|
+
tags : []
|
|
112
|
+
});
|
|
97
113
|
});
|
|
98
114
|
|
|
99
|
-
it('should
|
|
115
|
+
it('should skip `/* */` comments', function() {
|
|
100
116
|
expect(parsed(function(){
|
|
101
117
|
/*
|
|
102
118
|
*
|
|
@@ -106,7 +122,7 @@ describe('Single comment string parsing', function() {
|
|
|
106
122
|
.to.eq(0);
|
|
107
123
|
});
|
|
108
124
|
|
|
109
|
-
it('should
|
|
125
|
+
it('should skip `/*** */` comments', function() {
|
|
110
126
|
expect(parsed(function(){
|
|
111
127
|
/*
|
|
112
128
|
*
|
|
@@ -116,21 +132,46 @@ describe('Single comment string parsing', function() {
|
|
|
116
132
|
.to.eq(0);
|
|
117
133
|
});
|
|
118
134
|
|
|
135
|
+
it('should parse one line block with tag', function() {
|
|
136
|
+
expect(parsed(function(){
|
|
137
|
+
/** @tag */
|
|
138
|
+
var a;
|
|
139
|
+
})[0])
|
|
140
|
+
.to.eql({
|
|
141
|
+
description : '',
|
|
142
|
+
line : 1,
|
|
143
|
+
source : '@tag',
|
|
144
|
+
tags : [{
|
|
145
|
+
tag : 'tag',
|
|
146
|
+
type : '',
|
|
147
|
+
name : '',
|
|
148
|
+
description : '',
|
|
149
|
+
line : 1,
|
|
150
|
+
optional : false,
|
|
151
|
+
source : '@tag'
|
|
152
|
+
}]
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
119
156
|
it('should parse `@tag`', function() {
|
|
120
157
|
expect(parsed(function(){
|
|
121
158
|
/**
|
|
159
|
+
*
|
|
122
160
|
* @my-tag
|
|
123
161
|
*/
|
|
124
162
|
var a;
|
|
125
163
|
})[0])
|
|
126
164
|
.to.eql({
|
|
127
|
-
line :
|
|
165
|
+
line : 1,
|
|
166
|
+
source : '@my-tag',
|
|
128
167
|
description : '',
|
|
129
168
|
tags: [{
|
|
130
|
-
line :
|
|
169
|
+
line : 3,
|
|
131
170
|
tag : 'my-tag',
|
|
171
|
+
source : '@my-tag',
|
|
132
172
|
type : '',
|
|
133
173
|
name : '',
|
|
174
|
+
optional : false,
|
|
134
175
|
description : ''
|
|
135
176
|
}]
|
|
136
177
|
});
|
|
@@ -144,164 +185,218 @@ describe('Single comment string parsing', function() {
|
|
|
144
185
|
var a;
|
|
145
186
|
})[0])
|
|
146
187
|
.to.eql({
|
|
147
|
-
line :
|
|
188
|
+
line : 1,
|
|
189
|
+
source : '@my-tag {my.type}',
|
|
148
190
|
description : '',
|
|
149
191
|
tags: [{
|
|
150
|
-
line :
|
|
192
|
+
line : 2,
|
|
151
193
|
tag : 'my-tag',
|
|
152
194
|
type : 'my.type',
|
|
153
195
|
name : '',
|
|
196
|
+
source : '@my-tag {my.type}',
|
|
197
|
+
optional : false,
|
|
154
198
|
description : ''
|
|
155
199
|
}]
|
|
156
200
|
});
|
|
157
201
|
});
|
|
158
202
|
|
|
159
|
-
it('should parse
|
|
203
|
+
it('should parse tag with name only `@tag name`', function() {
|
|
160
204
|
expect(parsed(function(){
|
|
161
205
|
/**
|
|
162
|
-
* @my-tag
|
|
206
|
+
* @my-tag name
|
|
163
207
|
*/
|
|
164
|
-
var a;
|
|
165
208
|
})[0])
|
|
166
209
|
.to.eql({
|
|
167
|
-
line :
|
|
210
|
+
line : 1,
|
|
168
211
|
description : '',
|
|
212
|
+
source : '@my-tag name',
|
|
169
213
|
tags: [{
|
|
214
|
+
line : 2,
|
|
170
215
|
tag : 'my-tag',
|
|
171
|
-
|
|
172
|
-
type : 'my.type',
|
|
216
|
+
type : '',
|
|
173
217
|
name : 'name',
|
|
218
|
+
source : '@my-tag name',
|
|
219
|
+
optional : false,
|
|
174
220
|
description : ''
|
|
175
221
|
}]
|
|
176
222
|
});
|
|
177
223
|
});
|
|
178
224
|
|
|
179
|
-
it('should parse `@tag name`', function() {
|
|
225
|
+
it('should parse tag with type and name `@tag {my.type} name`', function() {
|
|
180
226
|
expect(parsed(function(){
|
|
181
227
|
/**
|
|
182
|
-
* @my-tag name
|
|
228
|
+
* @my-tag {my.type} name
|
|
183
229
|
*/
|
|
184
230
|
})[0])
|
|
185
231
|
.to.eql({
|
|
186
|
-
line :
|
|
232
|
+
line : 1,
|
|
233
|
+
source : '@my-tag {my.type} name',
|
|
187
234
|
description : '',
|
|
188
235
|
tags: [{
|
|
189
|
-
line : 1,
|
|
190
236
|
tag : 'my-tag',
|
|
191
|
-
|
|
237
|
+
line : 2,
|
|
238
|
+
type : 'my.type',
|
|
192
239
|
name : 'name',
|
|
193
|
-
|
|
240
|
+
source : '@my-tag {my.type} name',
|
|
241
|
+
description : '',
|
|
242
|
+
optional : false
|
|
194
243
|
}]
|
|
195
244
|
});
|
|
196
245
|
});
|
|
197
246
|
|
|
198
|
-
it('should parse
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
expect(p[0].tags[0].name)
|
|
221
|
-
.to.eq('');
|
|
247
|
+
it('should parse tag with type, name and description `@tag {my.type} name description`', function() {
|
|
248
|
+
expect(parsed(function(){
|
|
249
|
+
/**
|
|
250
|
+
* @my-tag {my.type} name description
|
|
251
|
+
*/
|
|
252
|
+
})[0])
|
|
253
|
+
.to.eql({
|
|
254
|
+
line : 1,
|
|
255
|
+
source : '@my-tag {my.type} name description',
|
|
256
|
+
description : '',
|
|
257
|
+
tags: [{
|
|
258
|
+
tag : 'my-tag',
|
|
259
|
+
line : 2,
|
|
260
|
+
type : 'my.type',
|
|
261
|
+
name : 'name',
|
|
262
|
+
source : '@my-tag {my.type} name description',
|
|
263
|
+
description : 'description',
|
|
264
|
+
optional : false
|
|
265
|
+
}]
|
|
266
|
+
});
|
|
267
|
+
});
|
|
222
268
|
|
|
223
|
-
|
|
224
|
-
|
|
269
|
+
it('should parse tag with multiline description', function() {
|
|
270
|
+
expect(parsed(function(){
|
|
271
|
+
/**
|
|
272
|
+
* @my-tag {my.type} name description line 1
|
|
273
|
+
* description line 2
|
|
274
|
+
* description line 3
|
|
275
|
+
*/
|
|
276
|
+
})[0])
|
|
277
|
+
.to.eql({
|
|
278
|
+
line : 1,
|
|
279
|
+
source : '@my-tag {my.type} name description line 1\ndescription line 2\ndescription line 3',
|
|
280
|
+
description : '',
|
|
281
|
+
tags: [{
|
|
282
|
+
tag : 'my-tag',
|
|
283
|
+
line : 2,
|
|
284
|
+
type : 'my.type',
|
|
285
|
+
name : 'name',
|
|
286
|
+
source : '@my-tag {my.type} name description line 1\ndescription line 2\ndescription line 3',
|
|
287
|
+
description : 'description line 1\ndescription line 2\ndescription line 3',
|
|
288
|
+
optional : false
|
|
289
|
+
}]
|
|
290
|
+
});
|
|
225
291
|
});
|
|
226
292
|
|
|
227
|
-
it('should parse `@tag {my.type} [name]`', function() {
|
|
293
|
+
it('should parse tag with type and optional name `@tag {my.type} [name]`', function() {
|
|
228
294
|
expect(parsed(function(){
|
|
229
295
|
/**
|
|
230
296
|
* @my-tag {my.type} [name]
|
|
231
297
|
*/
|
|
232
298
|
})[0])
|
|
233
299
|
.to.eql({
|
|
234
|
-
line :
|
|
300
|
+
line : 1,
|
|
235
301
|
description : '',
|
|
302
|
+
source : '@my-tag {my.type} [name]',
|
|
236
303
|
tags: [{
|
|
237
304
|
tag : 'my-tag',
|
|
238
|
-
line :
|
|
305
|
+
line : 2,
|
|
239
306
|
type : 'my.type',
|
|
240
307
|
name : 'name',
|
|
241
308
|
description : '',
|
|
309
|
+
source : '@my-tag {my.type} [name]',
|
|
242
310
|
optional : true
|
|
243
311
|
}]
|
|
244
312
|
});
|
|
245
313
|
});
|
|
246
314
|
|
|
247
|
-
|
|
248
|
-
|
|
315
|
+
it('should parse tag with type and optional name with default value `@tag {my.type} [name=value]`', function() {
|
|
316
|
+
expect(parsed(function(){
|
|
317
|
+
/**
|
|
318
|
+
* @my-tag {my.type} [name=value]
|
|
319
|
+
*/
|
|
320
|
+
})[0])
|
|
321
|
+
.to.eql({
|
|
322
|
+
line : 1,
|
|
323
|
+
description : '',
|
|
324
|
+
source : '@my-tag {my.type} [name=value]',
|
|
325
|
+
tags: [{
|
|
326
|
+
tag : 'my-tag',
|
|
327
|
+
line : 2,
|
|
328
|
+
type : 'my.type',
|
|
329
|
+
name : 'name',
|
|
330
|
+
default : 'value',
|
|
331
|
+
source : '@my-tag {my.type} [name=value]',
|
|
332
|
+
description : '',
|
|
333
|
+
optional : true
|
|
334
|
+
}]
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
it('should tolerate default value with whitespces `@tag {my.type} [name=John Doe]`', function() {
|
|
249
339
|
expect(parsed(function(){
|
|
250
340
|
/**
|
|
251
341
|
* @my-tag {my.type} [name=John Doe]
|
|
252
342
|
*/
|
|
253
343
|
})[0])
|
|
254
344
|
.to.eql({
|
|
255
|
-
line :
|
|
345
|
+
line : 1,
|
|
256
346
|
description : '',
|
|
347
|
+
source : '@my-tag {my.type} [name=John Doe]',
|
|
257
348
|
tags: [{
|
|
258
349
|
tag : 'my-tag',
|
|
259
|
-
line :
|
|
350
|
+
line : 2,
|
|
260
351
|
type : 'my.type',
|
|
261
352
|
name : 'name',
|
|
262
353
|
description : '',
|
|
354
|
+
source : '@my-tag {my.type} [name=John Doe]',
|
|
263
355
|
optional : true,
|
|
264
356
|
default : 'John Doe'
|
|
265
357
|
}]
|
|
266
358
|
});
|
|
267
359
|
});
|
|
268
360
|
|
|
269
|
-
|
|
270
|
-
it('should parse quoted optionals like `@tag [name="yay"] desc`', function() {
|
|
361
|
+
it('should tolerate quoted default value `@tag [name="yay!"]`', function() {
|
|
271
362
|
expect(parsed(function(){
|
|
272
363
|
/**
|
|
273
|
-
* @tag {t} [name="yay!"]
|
|
364
|
+
* @tag {t} [name="yay!"]
|
|
274
365
|
*/
|
|
275
366
|
})[0])
|
|
276
367
|
.to.eql({
|
|
277
|
-
line:
|
|
368
|
+
line: 1,
|
|
369
|
+
source: '@tag {t} [name="yay!"]',
|
|
278
370
|
description: '',
|
|
279
371
|
tags: [{
|
|
280
372
|
tag : 'tag',
|
|
281
|
-
line :
|
|
373
|
+
line : 2,
|
|
282
374
|
type : 't',
|
|
283
375
|
name : 'name',
|
|
376
|
+
source : '@tag {t} [name="yay!"]',
|
|
284
377
|
default : 'yay!',
|
|
285
378
|
optional : true,
|
|
286
|
-
description : '
|
|
379
|
+
description : ''
|
|
287
380
|
}]
|
|
288
381
|
});
|
|
289
382
|
});
|
|
290
383
|
|
|
291
|
-
it('
|
|
384
|
+
it('should keep value as is if quotes are mismatched `@tag [name="yay\']`', function() {
|
|
292
385
|
expect(parsed(function(){
|
|
293
386
|
/**
|
|
294
387
|
* @tag {t} [name="yay!'] desc
|
|
295
388
|
*/
|
|
296
389
|
})[0])
|
|
297
390
|
.to.eql({
|
|
298
|
-
line:
|
|
391
|
+
line: 1,
|
|
299
392
|
description: '',
|
|
393
|
+
source : '@tag {t} [name="yay!\'] desc',
|
|
300
394
|
tags: [{
|
|
301
395
|
tag : 'tag',
|
|
302
|
-
line :
|
|
396
|
+
line : 2,
|
|
303
397
|
type : 't',
|
|
304
398
|
name : 'name',
|
|
399
|
+
source : '@tag {t} [name="yay!\'] desc',
|
|
305
400
|
default : '"yay!\'',
|
|
306
401
|
optional : true,
|
|
307
402
|
description : 'desc'
|
|
@@ -309,21 +404,45 @@ describe('Single comment string parsing', function() {
|
|
|
309
404
|
});
|
|
310
405
|
});
|
|
311
406
|
|
|
312
|
-
it('should parse
|
|
407
|
+
it('should parse rest names `@tag ...name desc`', function() {
|
|
408
|
+
expect(parsed(function(){
|
|
409
|
+
/**
|
|
410
|
+
* @tag {t} ...name desc
|
|
411
|
+
*/
|
|
412
|
+
})[0])
|
|
413
|
+
.to.eql({
|
|
414
|
+
line : 1,
|
|
415
|
+
description : '',
|
|
416
|
+
source : '@tag {t} ...name desc',
|
|
417
|
+
tags: [{
|
|
418
|
+
tag : 'tag',
|
|
419
|
+
line : 2,
|
|
420
|
+
type : 't',
|
|
421
|
+
name : '...name',
|
|
422
|
+
optional : false,
|
|
423
|
+
source : '@tag {t} ...name desc',
|
|
424
|
+
description : 'desc'
|
|
425
|
+
}]
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
it('should parse optionalrest names `@tag [...name] desc`', function() {
|
|
313
430
|
expect(parsed(function(){
|
|
314
431
|
/**
|
|
315
432
|
* @tag {t} [...name] desc
|
|
316
433
|
*/
|
|
317
434
|
})[0])
|
|
318
435
|
.to.eql({
|
|
319
|
-
line:
|
|
320
|
-
description: '',
|
|
436
|
+
line : 1,
|
|
437
|
+
description : '',
|
|
438
|
+
source : '@tag {t} [...name] desc',
|
|
321
439
|
tags: [{
|
|
322
440
|
tag : 'tag',
|
|
323
|
-
line :
|
|
441
|
+
line : 2,
|
|
324
442
|
type : 't',
|
|
325
443
|
name : '...name',
|
|
326
444
|
optional : true,
|
|
445
|
+
source : '@tag {t} [...name] desc',
|
|
327
446
|
description : 'desc'
|
|
328
447
|
}]
|
|
329
448
|
});
|
|
@@ -340,17 +459,22 @@ describe('Single comment string parsing', function() {
|
|
|
340
459
|
.to.eql({
|
|
341
460
|
line : 1,
|
|
342
461
|
description : 'Description',
|
|
462
|
+
source : 'Description\n@my-tag1\n@my-tag2',
|
|
343
463
|
tags : [{
|
|
344
464
|
tag : 'my-tag1',
|
|
345
|
-
line :
|
|
465
|
+
line : 3,
|
|
346
466
|
type : '',
|
|
347
467
|
name : '',
|
|
468
|
+
optional : false,
|
|
469
|
+
source : '@my-tag1',
|
|
348
470
|
description : ''
|
|
349
471
|
}, {
|
|
350
472
|
tag : 'my-tag2',
|
|
351
|
-
line :
|
|
473
|
+
line : 4,
|
|
352
474
|
type : '',
|
|
353
475
|
name : '',
|
|
476
|
+
optional : false,
|
|
477
|
+
source : '@my-tag2',
|
|
354
478
|
description : ''
|
|
355
479
|
}]
|
|
356
480
|
});
|
|
@@ -368,23 +492,30 @@ describe('Single comment string parsing', function() {
|
|
|
368
492
|
.to.eql({
|
|
369
493
|
line : 1,
|
|
370
494
|
description : 'Description',
|
|
495
|
+
source : "Description\n@my-tag name\n@my-tag name.sub-name\n@my-tag name.sub-name.sub-sub-name",
|
|
371
496
|
tags : [{
|
|
372
497
|
tag : 'my-tag',
|
|
373
|
-
line :
|
|
498
|
+
line : 3,
|
|
374
499
|
type : '',
|
|
375
500
|
name : 'name',
|
|
501
|
+
source : '@my-tag name',
|
|
502
|
+
optional : false,
|
|
376
503
|
description : '',
|
|
377
504
|
tags : [{
|
|
378
505
|
tag : 'my-tag',
|
|
379
|
-
line :
|
|
506
|
+
line : 4,
|
|
380
507
|
type : '',
|
|
381
508
|
name : 'sub-name',
|
|
509
|
+
optional : false,
|
|
510
|
+
source : '@my-tag name.sub-name',
|
|
382
511
|
description : '',
|
|
383
512
|
tags : [{
|
|
384
513
|
tag : 'my-tag',
|
|
385
|
-
line :
|
|
514
|
+
line : 5,
|
|
386
515
|
type : '',
|
|
387
516
|
name : 'sub-sub-name',
|
|
517
|
+
optional : false,
|
|
518
|
+
source : '@my-tag name.sub-name.sub-sub-name',
|
|
388
519
|
description : ''
|
|
389
520
|
}]
|
|
390
521
|
}]
|
|
@@ -399,13 +530,16 @@ describe('Single comment string parsing', function() {
|
|
|
399
530
|
*/
|
|
400
531
|
})[0])
|
|
401
532
|
.to.eql({
|
|
402
|
-
line:
|
|
403
|
-
|
|
533
|
+
line : 1,
|
|
534
|
+
source : '@my-tag {{a: number}} name',
|
|
535
|
+
description : '',
|
|
404
536
|
tags: [{
|
|
405
537
|
tag : 'my-tag',
|
|
406
|
-
line :
|
|
538
|
+
line : 2,
|
|
407
539
|
type : '{a: number}',
|
|
408
540
|
name : 'name',
|
|
541
|
+
source : '@my-tag {{a: number}} name',
|
|
542
|
+
optional : false,
|
|
409
543
|
description : ''
|
|
410
544
|
}]
|
|
411
545
|
});
|
|
@@ -418,15 +552,18 @@ describe('Single comment string parsing', function() {
|
|
|
418
552
|
*/
|
|
419
553
|
})[0])
|
|
420
554
|
.to.eql({
|
|
421
|
-
line:
|
|
422
|
-
description: '',
|
|
555
|
+
line : 1,
|
|
556
|
+
description : '',
|
|
557
|
+
source : '@my-tag {{a: number} name',
|
|
423
558
|
tags: [{
|
|
424
559
|
tag : 'my-tag',
|
|
425
|
-
line :
|
|
560
|
+
line : 2,
|
|
426
561
|
type : '',
|
|
427
562
|
name : '',
|
|
428
|
-
description : '
|
|
429
|
-
|
|
563
|
+
description : '',
|
|
564
|
+
source : '@my-tag {{a: number} name',
|
|
565
|
+
optional : false,
|
|
566
|
+
errors : ['parse_type: Invalid `{type}`, unpaired curlies']
|
|
430
567
|
}]
|
|
431
568
|
});
|
|
432
569
|
});
|