mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Tests for @augment and @private.
This commit is contained in:
parent
be57089d7c
commit
8f5f41f78c
@ -75,11 +75,6 @@
|
||||
applyTag.call(this, newTag);
|
||||
}
|
||||
|
||||
exports.Doclet.prototype.augment = function(base) {
|
||||
if (!this.mixins) { this.mixins = []; }
|
||||
this.mixins.push( {source: source, target: (target||'this')} );
|
||||
}
|
||||
|
||||
exports.Doclet.prototype.setMemberof = function(sid) {
|
||||
this.memberof = sid;
|
||||
}
|
||||
|
||||
@ -31,25 +31,28 @@
|
||||
}
|
||||
});
|
||||
|
||||
// I add on to that
|
||||
dictionary.defineTag('augments', {
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
doclet.augment(tag.value);
|
||||
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.synonym('extends');
|
||||
|
||||
dictionary.defineTag('borrows', {
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
parseBorrows(doclet, tag);
|
||||
doclet.augment( firstWordOf(tag.value) );
|
||||
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.synonym('extends')
|
||||
.synonym('inherits');
|
||||
|
||||
// that adds on to me
|
||||
dictionary.defineTag('borrows', {
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
var [target, source] = parseBorrows(doclet, tag);
|
||||
doclet.borrow(target, source);
|
||||
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.synonym('mixes');
|
||||
|
||||
dictionary.defineTag('class', {
|
||||
@ -444,10 +447,10 @@
|
||||
var m = /^(\S+)(?:\s+as\s+(\S+))?$/.exec(tag.text);
|
||||
if (m) {
|
||||
if (m[1] && m[2]) {
|
||||
doclet.borrow(m[1], m[2]);
|
||||
return [ m[1], m[2] ];
|
||||
}
|
||||
else if (m[1]) {
|
||||
doclet.borrow(m[1]);
|
||||
return [ m[1] ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
14
test/cases/augmentstag.js
Normal file
14
test/cases/augmentstag.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function Foo() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @extends Foo
|
||||
*/
|
||||
function Bar() {
|
||||
}
|
||||
|
||||
|
||||
11
test/cases/privatetag.js
Normal file
11
test/cases/privatetag.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
function Foo() {
|
||||
|
||||
/** document me */
|
||||
this.bar = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -89,6 +89,7 @@ testFile('test/t/cases/modules/data/mod-2.js');
|
||||
testFile('test/t/cases/alias.js');
|
||||
testFile('test/t/cases/alias2.js');
|
||||
|
||||
testFile('test/t/cases/augmentstag.js');
|
||||
testFile('test/t/cases/accesstag.js');
|
||||
testFile('test/t/cases/authortag.js');
|
||||
testFile('test/t/cases/copyrighttag.js');
|
||||
@ -97,6 +98,7 @@ testFile('test/t/cases/exceptiontag.js');
|
||||
testFile('test/t/cases/globaltag.js');
|
||||
testFile('test/t/cases/ignoretag.js');
|
||||
testFile('test/t/cases/paramtag.js');
|
||||
testFile('test/t/cases/privatetag.js');
|
||||
testFile('test/t/cases/requirestag.js');
|
||||
testFile('test/t/cases/returnstag.js');
|
||||
testFile('test/t/cases/seetag.js');
|
||||
|
||||
12
test/t/cases/augmentstag.js
Normal file
12
test/t/cases/augmentstag.js
Normal file
@ -0,0 +1,12 @@
|
||||
(function() {
|
||||
var docSet = testhelpers.getDocSetFromFile('test/cases/augmentstag.js'),
|
||||
foo = docSet.getByLongname('Foo')[0],
|
||||
bar = docSet.getByLongname('Bar')[0];
|
||||
|
||||
//dump(docSet.doclets); exit(0);
|
||||
|
||||
test('When a symbol has an @augments tag, the doclet has a augments property that includes that value.', function() {
|
||||
assert.equal(typeof bar.augments, 'object');
|
||||
assert.equal(bar.augments[0], 'Foo');
|
||||
});
|
||||
})();
|
||||
11
test/t/cases/privatetag.js
Normal file
11
test/t/cases/privatetag.js
Normal file
@ -0,0 +1,11 @@
|
||||
(function() {
|
||||
var docSet = testhelpers.getDocSetFromFile('test/cases/privatetag.js'),
|
||||
foo = docSet.getByLongname('Foo')[0],
|
||||
bar = docSet.getByLongname('Foo#bar')[0];
|
||||
|
||||
//dump(docSet.doclets); exit(0);
|
||||
|
||||
test('When a symbol has an @private tag, the doclet has an access property that is "private".', function() {
|
||||
assert.equal(foo.access, 'private');
|
||||
});
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user