Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
Update: Add support for slash in namepaths (fixes #100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Duffy committed Feb 15, 2016
1 parent 2582436 commit b082f85
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/doctrine.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@
name += advance();
}
while (source.charCodeAt(index) === 0x2E /* '.' */ ||
source.charCodeAt(index) === 0x2F /* '/' */ ||
source.charCodeAt(index) === 0x23 /* '#' */ ||
source.charCodeAt(index) === 0x7E /* '~' */) {
name += advance();
Expand Down
21 changes: 21 additions & 0 deletions test/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ describe('parse', function () {
res.tags[0].should.have.property('name', 'aliasName.OK');
});

it('alias with namepath', function () {
var res = doctrine.parse('/** @alias module:mymodule/mymodule.init */', { unwrap: true });
res.tags.should.have.length(1);
res.tags[0].should.have.property('title', 'alias');
res.tags[0].should.have.property('name', 'module:mymodule/mymodule.init');
});

it('const', function () {
var res = doctrine.parse('/** @const */', { unwrap: true });
res.tags.should.have.length(1);
Expand Down Expand Up @@ -337,6 +344,13 @@ describe('parse', function () {
});
});

it('module with path', function () {
var res = doctrine.parse('/** @module path/to/thingName.name */', { unwrap: true });
res.tags.should.have.length(1);
res.tags[0].should.have.property('title', 'module');
res.tags[0].should.have.property('name', 'path/to/thingName.name');
});

it('name', function () {
var res = doctrine.parse('/** @name thingName.name */', { unwrap: true });
res.tags.should.have.length(1);
Expand Down Expand Up @@ -789,6 +803,13 @@ describe('parse', function () {
res.tags[0].should.have.property('name', 'ClassName.OK');
});

it('extends with namepath', function () {
var res = doctrine.parse('/** @extends module:path/ClassName~OK */', { unwrap: true });
res.tags.should.have.length(1);
res.tags[0].should.have.property('title', 'extends');
res.tags[0].should.have.property('name', 'module:path/ClassName~OK');
});

it('prop', function () {
var res = doctrine.parse(
[
Expand Down

0 comments on commit b082f85

Please sign in to comment.