@@ -186,30 +186,128 @@ test('inferMembership - explicit', function (t) {
186186} ) ;
187187
188188test ( 'inferMembership - exports' , function ( t ) {
189- var result = evaluate ( function ( ) {
190- /**
191- * @module mod
192- */
193- /** Test */
189+ t . equal ( evaluate ( function ( ) {
190+ /** @module mod */
191+ /** foo */
194192 exports . foo = 1 ;
195- } ) ;
193+ } ) [ 1 ] . memberof , 'mod' ) ;
194+
195+ t . equal ( evaluate ( function ( ) {
196+ /** @module mod */
197+ /** @returns {undefined } foo */
198+ exports . foo = function ( ) { } ;
199+ } ) [ 1 ] . memberof , 'mod' ) ;
200+
201+ t . equal ( evaluate ( function ( ) {
202+ /** @module mod */
203+ /** bar */
204+ exports . foo . bar = 1 ;
205+ } ) [ 1 ] . memberof , 'mod.foo' ) ;
206+
207+ t . equal ( evaluate ( function ( ) {
208+ /** @module mod */
209+ exports . foo = {
210+ /** bar */
211+ bar : 1
212+ } ;
213+ } ) [ 1 ] . memberof , 'mod.foo' ) ;
214+
215+ t . equal ( evaluate ( function ( ) {
216+ /** @module mod */
217+ exports . foo = {
218+ /** @returns {undefined } bar */
219+ bar : function ( ) { }
220+ } ;
221+ } ) [ 1 ] . memberof , 'mod.foo' ) ;
222+
223+ t . equal ( evaluate ( function ( ) {
224+ /** @module mod */
225+ /** @returns {undefined } bar */
226+ exports . foo . prototype . bar = function ( ) { } ;
227+ } ) [ 1 ] . memberof , 'mod.foo' ) ;
228+
229+ t . equal ( evaluate ( function ( ) {
230+ /** @module mod */
231+ exports . foo . prototype = {
232+ /** @returns {undefined } bar */
233+ bar : function ( ) { }
234+ } ;
235+ } ) [ 1 ] . memberof , 'mod.foo' ) ;
196236
197- t . equal ( result . length , 2 ) ;
198- t . equal ( result [ 1 ] . memberof , 'mod' ) ;
199237 t . end ( ) ;
200238} ) ;
201239
202240test ( 'inferMembership - module.exports' , function ( t ) {
203- var result = evaluate ( function ( ) {
204- /**
205- * @module mod
206- */
207- /** Test */
241+ t . equal ( evaluate ( function ( ) {
242+ /** @module mod */
243+ /** foo */
208244 module . exports . foo = 1 ;
209- } ) ;
245+ } ) [ 1 ] . memberof , 'mod' ) ;
246+
247+ t . equal ( evaluate ( function ( ) {
248+ /** @module mod */
249+ /** @returns {undefined } foo */
250+ module . exports . foo = function ( ) { } ;
251+ } ) [ 1 ] . memberof , 'mod' ) ;
252+
253+ t . equal ( evaluate ( function ( ) {
254+ /** @module mod */
255+ /** bar */
256+ module . exports . foo . bar = 1 ;
257+ } ) [ 1 ] . memberof , 'mod.foo' ) ;
258+
259+ t . equal ( evaluate ( function ( ) {
260+ /** @module mod */
261+ module . exports . foo = {
262+ /** bar */
263+ bar : 1
264+ } ;
265+ } ) [ 1 ] . memberof , 'mod.foo' ) ;
266+
267+ t . equal ( evaluate ( function ( ) {
268+ /** @module mod */
269+ module . exports . foo = {
270+ /** @returns {undefined } bar */
271+ bar : function ( ) { }
272+ } ;
273+ } ) [ 1 ] . memberof , 'mod.foo' ) ;
274+
275+ t . equal ( evaluate ( function ( ) {
276+ /** @module mod */
277+ /** @returns {undefined } bar */
278+ module . exports . prototype . bar = function ( ) { } ;
279+ } ) [ 1 ] . memberof , 'mod' ) ;
280+
281+ t . equal ( evaluate ( function ( ) {
282+ /** @module mod */
283+ module . exports . prototype = {
284+ /** @returns {undefined } bar */
285+ bar : function ( ) { }
286+ } ;
287+ } ) [ 1 ] . memberof , 'mod' ) ;
288+
289+ // https://github.com/documentationjs/documentation/issues/178
290+ //
291+ // t.equal(evaluate(function () {
292+ // /** @module mod */
293+ // /** foo */
294+ // module.exports = 1;
295+ // })[1].memberof, 'mod');
296+ //
297+ // t.equal(evaluate(function () {
298+ // /** @module mod */
299+ // /** @returns {undefined } foo */
300+ // module.exports = function () {};
301+ // })[1].memberof, 'mod');
302+
303+ t . equal ( evaluate ( function ( ) {
304+ /** @module mod */
305+ module . exports = {
306+ /** foo */
307+ foo : 1
308+ } ;
309+ } ) [ 1 ] . memberof , 'mod' ) ;
210310
211- t . equal ( result . length , 2 ) ;
212- t . equal ( result [ 1 ] . memberof , 'mod' ) ;
213311 t . end ( ) ;
214312} ) ;
215313
@@ -227,7 +325,7 @@ test('inferMembership - not module exports', function (t) {
227325 t . end ( ) ;
228326} ) ;
229327
230- test ( 'inferMembership - anonymous module' , function ( t ) {
328+ test ( 'inferMembership - anonymous @ module' , function ( t ) {
231329 var result = evaluate ( function ( ) {
232330 /**
233331 * @module
@@ -241,7 +339,7 @@ test('inferMembership - anonymous module', function (t) {
241339 t . end ( ) ;
242340} ) ;
243341
244- test ( 'inferMembership - no module' , function ( t ) {
342+ test ( 'inferMembership - no @ module' , function ( t ) {
245343 var result = evaluate ( function ( ) {
246344 /** Test */
247345 exports . foo = 1 ;
0 commit comments