From 4c69d694d75f01cffbc75be331b5636068a41048 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 17 Nov 2010 12:13:04 -0800 Subject: make @returns type non-optional --- docs/collect.js | 6 +++--- docs/spec/collectSpec.js | 20 +++++--------------- 2 files changed, 8 insertions(+), 18 deletions(-) (limited to 'docs') diff --git a/docs/collect.js b/docs/collect.js index 5a5e3ee9..2cb85fe2 100644 --- a/docs/collect.js +++ b/docs/collect.js @@ -208,12 +208,12 @@ function propertyTag(doc, name, value) { } function returnsTag(doc, name, value) { - var match = value.match(/^({(\S+)}\s*)?(.*)?/); + var match = value.match(/^{(\S+)}\s+(.*)?/); if (match) { var tag = { - type: match[2], - description: match[3] || false + type: match[1], + description: match[2] || false }; } else { throw "[" + doc.raw.file + ":" + doc.raw.line + diff --git a/docs/spec/collectSpec.js b/docs/spec/collectSpec.js index 4d398be3..7777e8f4 100644 --- a/docs/spec/collectSpec.js +++ b/docs/spec/collectSpec.js @@ -161,24 +161,14 @@ describe('collect', function(){ }); describe('@returns', function() { - it('should parse @returns', function() { - expect(function() {TAG.returns(doc, 'returns', '');}) - .not.toThrow(); - }); - - it('should parse @returns with type', function() { - TAG.returns(doc, 'returns', '{string}'); - expect(doc.returns.type).toEqual('string'); - }); - - it('should parse @returns with description', function() { - TAG.returns(doc, 'returns', 'descrip tion'); - expect(doc.returns.description).toEqual('descrip tion'); + it('should not parse @returns without type', function() { + expect(function() {TAG.returns(doc, 'returns', 'lala');}) + .toThrow(); }); it('should parse @returns with type and description', function() { - TAG.returns(doc, 'returns', '{string} description'); - expect(doc.returns).toEqual({type: 'string', description: 'description'}); + TAG.returns(doc, 'returns', '{string} descrip tion'); + expect(doc.returns).toEqual({type: 'string', description: 'descrip tion'}); }); }); -- cgit v1.2.3