Skip to content

Commit

Permalink
allow for arbitrary tags + tests
Browse files Browse the repository at this point in the history
  • Loading branch information
logicalparadox committed Dec 9, 2011
1 parent ca0a890 commit 42a3fcb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/dox.js
Expand Up @@ -158,6 +158,9 @@ exports.parseTag = function(str) {
case 'type':
tag.types = exports.parseTagTypes(parts.shift());
break;
default:
tag.string = parts.join(' ');
break;
}

return tag;
Expand Down
8 changes: 7 additions & 1 deletion test/dox.test.js
Expand Up @@ -123,7 +123,7 @@ module.exports = {
fixture('d.js', function(err, str){
var comments = dox.parseComments(str);
var first = comments.shift();
first.tags.should.have.length(3);
first.tags.should.have.length(4);
first.description.full.should.equal('<p>Parse tag type string "{Array|Object}" etc.</p>');
first.description.summary.should.equal('<p>Parse tag type string "{Array|Object}" etc.</p>');
first.description.body.should.equal('');
Expand Down Expand Up @@ -242,5 +242,11 @@ module.exports = {
tag.type.should.equal('return');
tag.types.should.eql(['String']);
tag.description.should.equal('a normal string');
},

'test .parseTag() default': function(){
var tag = dox.parseTag('@hello universe is better than world');
tag.type.should.equal('hello');
tag.string.should.equal('universe is better than world');
}
};
1 change: 1 addition & 0 deletions test/fixtures/d.js
Expand Up @@ -2,6 +2,7 @@
/**
* Parse tag type string "{Array|Object}" etc.
*
* @name is arbitrary
* @param {String} str
* @return {Array}
* @api public
Expand Down

0 comments on commit 42a3fcb

Please sign in to comment.