mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Additional tests for @borrows.
This commit is contained in:
parent
bf7b667861
commit
2facb898bf
@ -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) {
|
||||
|
||||
@ -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
14
test/cases/borrowstag2.js
Normal 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) {
|
||||
}
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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');
|
||||
|
||||
14
test/t/cases/borrowstag2.js
Normal file
14
test/t/cases/borrowstag2.js
Normal 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);
|
||||
});
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user