Added test cases for the @returns tag.

This commit is contained in:
Michael Mathews 2011-01-16 11:28:39 +00:00
parent 8f73a4f2f1
commit dd990a434c
2 changed files with 31 additions and 0 deletions

11
test/cases/returnstag.js Normal file
View File

@ -0,0 +1,11 @@
/**
* @returns { String | Array<String>} The names of the found item(s).
*/
function find(targetName) {
}
/**
* @return The binding id.
*/
function bind(callback) {
}

View File

@ -0,0 +1,20 @@
(function() {
var docSet = testhelpers.getDocSetFromFile('test/cases/returnstag.js'),
find = docSet.getByLongname('find')[0],
bind = docSet.getByLongname('bind')[0];
//dump(docSet.doclets); exit(0);
test('When a symbol has an @returns tag with a type and description, the doclet has a returns property that includes that return.', function() {
assert.equal(typeof find.returns, 'object');
assert.equal(find.returns.type.names.join(', '), 'String, Array<String>');
assert.equal(find.returns.description, 'The names of the found item(s).');
});
test('When a symbol has an @param tag with only a type and name, the doclet has a params property that includes that param.', function() {
assert.equal(typeof bind.returns, 'object');
assert.equal(bind.returns.description, 'The binding id.');
});
})();