@@ -14,15 +14,13 @@ function toComment(fn, filename) {
1414test ( 'nestParams - no params' , function ( t ) {
1515 t . equal ( toComment ( function ( ) {
1616 /** @name foo */
17- return 0 ;
1817 } ) [ 0 ] . params , undefined , 'no params' ) ;
1918 t . end ( ) ;
2019} ) ;
2120
2221test ( 'nestParams - no nesting' , function ( t ) {
2322 var result = toComment ( function ( ) {
2423 /** @param {Object } foo */
25- return 0 ;
2624 } ) ;
2725 t . equal ( result [ 0 ] . params . length , 1 ) ;
2826 t . equal ( result [ 0 ] . params [ 0 ] . name , 'foo' ) ;
@@ -37,7 +35,6 @@ test('nestParams - basic', function (t) {
3735 * @param {string } foo.bar
3836 * @param {string } foo.baz
3937 */
40- return 0 ;
4138 } ) ;
4239 t . equal ( result [ 0 ] . params . length , 1 ) ;
4340 t . equal ( result [ 0 ] . params [ 0 ] . name , 'foo' ) ;
@@ -47,9 +44,25 @@ test('nestParams - basic', function (t) {
4744 t . end ( ) ;
4845} ) ;
4946
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+
5063test ( '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 */
5366 } ) ;
5467 t . equal ( result [ 0 ] . params . length , 1 ) ;
5568 t . deepEqual ( result [ 0 ] . errors [ 0 ] , {
0 commit comments