diff --git a/test/samples/tag_constructor.js b/test/samples/tag_constructor.js index c84ee6de..b3d623d4 100644 --- a/test/samples/tag_constructor.js +++ b/test/samples/tag_constructor.js @@ -15,4 +15,9 @@ function Pez() { /** @constructor */ Qux = function() { -} \ No newline at end of file +} + +var somevar, + /** @constructor */ + Blap = function(a, b) { + }; \ No newline at end of file diff --git a/test/tests/10_tag_constructor.js b/test/tests/10_tag_constructor.js index 2294b735..c613912c 100644 --- a/test/tests/10_tag_constructor.js +++ b/test/tests/10_tag_constructor.js @@ -10,19 +10,21 @@ tag: require('jsdoc/tag'), parser: require('jsdoc/parser') }; + jsdoc.parser.parseFiles(BASEDIR + 'test/samples/tag_constructor.js'); - doclets = jsdoc.parser.result; + + doclets = jsdoc.parser.result.map(function($){ return $.toObject(); }); }); describe('A doclet from a constructor tag with a name tag and no code', function() { it('should have an `isa` property set to "constructor"', function() { - var doclet = doclets[0].toObject(); + var doclet = doclets[0]; expect(doclet).to(have_property, 'isa'); expect(doclet.isa).to(eql, 'constructor'); }); it('should have a `name` property set to the given name"', function() { - var doclet = doclets[0].toObject(); + var doclet = doclets[0]; expect(doclet).to(have_property, 'name'); expect(doclet.name).to(eql, 'Foo'); }); @@ -30,13 +32,13 @@ describe('A doclet from a named constructor tag and no code', function() { it('should have an `isa` property set to "constructor"', function() { - var doclet = doclets[1].toObject(); + var doclet = doclets[1]; expect(doclet).to(have_property, 'isa'); expect(doclet.isa).to(eql, 'constructor'); }); it('should have a `name` property set to the given name"', function() { - var doclet = doclets[1].toObject(); + var doclet = doclets[1]; expect(doclet).to(have_property, 'name'); expect(doclet.name).to(eql, 'Bar'); }); @@ -44,13 +46,13 @@ describe('A doclet from a constructor tag and named code', function() { it('should have an `isa` property set to "constructor"', function() { - var doclet = doclets[2].toObject(); + var doclet = doclets[2]; expect(doclet).to(have_property, 'isa'); expect(doclet.isa).to(eql, 'constructor'); }); it('should have a `name` property set to the given name"', function() { - var doclet = doclets[2].toObject(); + var doclet = doclets[2]; expect(doclet).to(have_property, 'name'); expect(doclet.name).to(eql, 'Pez'); }); @@ -58,17 +60,31 @@ describe('A doclet from a constructor tag and named anonymous function', function() { it('should have an `isa` property set to "constructor"', function() { - var doclet = doclets[3].toObject(); + var doclet = doclets[3]; expect(doclet).to(have_property, 'isa'); expect(doclet.isa).to(eql, 'constructor'); }); it('should have a `name` property set to the given name"', function() { - var doclet = doclets[3].toObject(); + var doclet = doclets[3]; expect(doclet).to(have_property, 'name'); expect(doclet.name).to(eql, 'Qux'); }); }); + describe('A doclet from a constructor tag and named anonymous function part of a var', function() { + it('should have an `isa` property set to "constructor"', function() { + var doclet = doclets[4]; + expect(doclet).to(have_property, 'isa'); + expect(doclet.isa).to(eql, 'constructor'); + }); + + it('should have a `name` property set to the given name"', function() { + var doclet = doclets[4]; + expect(doclet).to(have_property, 'name'); + expect(doclet.name).to(eql, 'Blap'); + }); + }); + }); })(); \ No newline at end of file