mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
The second half of the first phase of the testing framework upgrade. This finishes moving the exisintg tests to jasmine and the new test directory structure
34 lines
1001 B
JavaScript
34 lines
1001 B
JavaScript
exports.getDocSetFromFile = function(filename) {
|
|
var sourceCode = readFile(__dirname + '/' + filename),
|
|
testParser,
|
|
doclets;
|
|
|
|
testParser = new (require('jsdoc/src/parser')).Parser();
|
|
require('jsdoc/src/handlers').attachTo(testParser);
|
|
|
|
doclets = testParser.parse('javascript:' + sourceCode);
|
|
exports.indexAll(doclets);
|
|
|
|
require('jsdoc/augment').addInherited(doclets);
|
|
|
|
// test assume borrows have not yet been resolved
|
|
// require('jsdoc/borrow').resolveBorrows(doclets);
|
|
|
|
return {
|
|
doclets: doclets,
|
|
getByLongname: function(longname) {
|
|
return doclets.filter(function(doclet) {
|
|
return (doclet.longname || doclet.name) === longname;
|
|
});
|
|
}
|
|
};
|
|
};
|
|
|
|
exports.indexAll = function(docs) {
|
|
var index = {};
|
|
docs.forEach(function(doc) {
|
|
if (!index.hasOwnProperty(doc.longname)){index[doc.longname] = [];}
|
|
index[doc.longname].push(doc);
|
|
});
|
|
docs.index = index;
|
|
}; |