Skip to content

Commit 74a08e9

Browse files
author
Alexej Yaroshevich
committed
jsdoc: fixup one liners parsing bug
1 parent 13ed645 commit 74a08e9

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

lib/jsdoc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ module.exports = {
3535
* @constructor
3636
*/
3737
function DocComment(value, loc) {
38+
assert.equal(typeof value, 'string', '');
39+
assert(typeof loc === 'object' && typeof loc.start === 'object' &&
40+
typeof loc.start.line === 'number' && typeof loc.start.column === 'number' &&
41+
loc.start.line > 0 && loc.start.column >= 0,
42+
'Location object should contains start field with valid line and column numbers');
43+
3844
// parse comments
3945
var _parsed = _parseComment(value) || {};
4046

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"node": ">= 0.10.0"
2323
},
2424
"dependencies": {
25-
"comment-parser": "^0.2.2",
25+
"comment-parser": "zxqfox/comment-parser#jscs-jsdoc",
2626
"jsdoctypeparser": "^1.1.3"
2727
},
2828
"devDependencies": {

test/lib/jsdoc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ describe('jsdoc', function() {
77
var Tag = jsdoc.tag;
88
var Comment = jsdoc.doc;
99

10+
describe('inline comment block', function() {
11+
var c1;
12+
13+
before(function() {
14+
c1 = new Comment('/** @tag1 */', {start: {line: 1, column: 0}});
15+
});
16+
17+
it('should parses tag', function() {
18+
expect(c1.tags.length).to.eq(1);
19+
20+
var tag1 = c1.tags[0];
21+
expect(tag1.id).to.eq('tag1');
22+
});
23+
24+
});
25+
1026
describe('location', function() {
1127

1228
it('should create valid location', function() {

0 commit comments

Comments
 (0)