@@ -14,15 +14,13 @@ function toComment(fn, filename) {
14
14
test ( 'nestParams - no params' , function ( t ) {
15
15
t . equal ( toComment ( function ( ) {
16
16
/** @name foo */
17
- return 0 ;
18
17
} ) [ 0 ] . params , undefined , 'no params' ) ;
19
18
t . end ( ) ;
20
19
} ) ;
21
20
22
21
test ( 'nestParams - no nesting' , function ( t ) {
23
22
var result = toComment ( function ( ) {
24
23
/** @param {Object } foo */
25
- return 0 ;
26
24
} ) ;
27
25
t . equal ( result [ 0 ] . params . length , 1 ) ;
28
26
t . equal ( result [ 0 ] . params [ 0 ] . name , 'foo' ) ;
@@ -37,7 +35,6 @@ test('nestParams - basic', function (t) {
37
35
* @param {string } foo.bar
38
36
* @param {string } foo.baz
39
37
*/
40
- return 0 ;
41
38
} ) ;
42
39
t . equal ( result [ 0 ] . params . length , 1 ) ;
43
40
t . equal ( result [ 0 ] . params [ 0 ] . name , 'foo' ) ;
@@ -47,9 +44,25 @@ test('nestParams - basic', function (t) {
47
44
t . end ( ) ;
48
45
} ) ;
49
46
47
+ test ( 'nestParams - array' , function ( t ) {
48
+ var result = toComment ( function ( ) {
49
+ /**
50
+ * @param {Object[] } employees - The employees who are responsible for the project.
51
+ * @param {string } employees[].name - The name of an employee.
52
+ * @param {string } employees[].department - The employee's department.
53
+ */
54
+ } ) ;
55
+ t . equal ( result [ 0 ] . params . length , 1 ) ;
56
+ t . equal ( result [ 0 ] . params [ 0 ] . name , 'employees' ) ;
57
+ t . equal ( result [ 0 ] . params [ 0 ] . properties . length , 2 ) ;
58
+ t . equal ( result [ 0 ] . params [ 0 ] . properties [ 0 ] . name , 'employees[].name' ) ;
59
+ t . equal ( result [ 0 ] . params [ 0 ] . properties [ 1 ] . name , 'employees[].department' ) ;
60
+ t . end ( ) ;
61
+ } ) ;
62
+
50
63
test ( 'nestParams - missing parent' , function ( t ) {
51
- var result = toComment ( function ( ) { /** @param { string } foo.bar */
52
- return 0 ;
64
+ var result = toComment ( function ( ) {
65
+ /** @param { string } foo.bar */
53
66
} ) ;
54
67
t . equal ( result [ 0 ] . params . length , 1 ) ;
55
68
t . deepEqual ( result [ 0 ] . errors [ 0 ] , {
0 commit comments