Additional tests for @borrows.

This commit is contained in:
Michael Mathews 2011-01-30 15:54:07 +00:00
parent bf7b667861
commit 2facb898bf
6 changed files with 32 additions and 3 deletions

View File

@ -98,7 +98,7 @@
*/
exports.Doclet.prototype.borrow = function(source, target) {
if (!this.borrowed) { this.borrowed = []; }
this.borrowed.push( {from: source, as: (target||'this')} );
this.borrowed.push( {from: source, as: (target||source)} );
}
exports.Doclet.prototype.augment = function(base) {

View File

@ -1,7 +1,7 @@
{
"name": "jsdoc",
"version": "3.0.0beta1",
"revision": "2011-01-24-2242",
"revision": "2011-01-30-1553",
"description": "An automatic documentation generator for javascript.",
"keywords": [ "documentation", "javascript" ],
"licenses": [

14
test/cases/borrowstag2.js Normal file
View File

@ -0,0 +1,14 @@
/** @namespace
@borrows rtrim
*/
var str = {
rtrim: rtrim
};
/**
Remove whitespace from the right side of a string.
@param {string} str
*/
function rtrim(str) {
}

View File

@ -93,6 +93,7 @@ testFile('test/t/cases/alias3.js');
testFile('test/t/cases/augmentstag.js');
testFile('test/t/cases/authortag.js');
testFile('test/t/cases/borrowstag.js');
testFile('test/t/cases/borrowstag2.js');
testFile('test/t/cases/classtag.js');
testFile('test/t/cases/constructstag.js');
testFile('test/t/cases/constructstag2.js');

View File

@ -6,7 +6,7 @@
//dump(found);
test('When a symbol has a @borrows tag, that is added to the symbol\'s "borrowed" property.', function() {
test('When a symbol has a @borrows-as tag, that is added to the symbol\'s "borrowed" property.', function() {
assert.equal(util.borrowed.length, 1);
assert.equal(util.borrowed[0].from, 'trstr');
assert.equal(util.borrowed[0].as, 'trim');

View File

@ -0,0 +1,14 @@
(function() {
var docSet = testhelpers.getDocSetFromFile('test/cases/borrowstag2.js'),
str = docSet.getByLongname('str').filter(function($) {
return ! $.undocumented;
})[0];
//dump(found);
test('When a symbol has a @borrows tag, that is added to the symbol\'s "borrowed" property and the from is the same as the as property.', function() {
assert.equal(str.borrowed.length, 1);
assert.equal(str.borrowed[0].from, 'rtrim');
assert.equal(str.borrowed[0].as, str.borrowed[0].from);
});
})();