mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added tests for @namespace.
This commit is contained in:
parent
e81f89cfbd
commit
f5b2ef38f2
@ -6,6 +6,7 @@ load(BASEDIR + '/test/tests/05_jsdoc_doclet.js');
|
||||
load(BASEDIR + '/test/tests/06_jsdoc_tag.js');
|
||||
|
||||
load(BASEDIR + '/test/tests/10_tag_constructor.js');
|
||||
load(BASEDIR + '/test/tests/11_tag_namespace.js');
|
||||
|
||||
// see http://visionmedia.github.com/jspec/
|
||||
JSpec.run({
|
||||
|
||||
@ -56,6 +56,20 @@
|
||||
});
|
||||
});
|
||||
|
||||
describe('A doclet from a constructor tag and named anonymous function', function() {
|
||||
it('should have an `isa` property set to "constructor"', function() {
|
||||
var doclet = doclets[3].toObject();
|
||||
expect(doclet).to(have_property, 'isa');
|
||||
expect(doclet.isa).to(eql, 'constructor');
|
||||
});
|
||||
|
||||
it('should have a `name` property set to the given name"', function() {
|
||||
var doclet = doclets[3].toObject();
|
||||
expect(doclet).to(have_property, 'name');
|
||||
expect(doclet.name).to(eql, 'Qux');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
@ -75,5 +89,10 @@
|
||||
*/
|
||||
function Pez() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@constructor
|
||||
*/
|
||||
Qux = function() {
|
||||
}
|
||||
})();
|
||||
93
test/tests/11_tag_namespace.js
Normal file
93
test/tests/11_tag_namespace.js
Normal file
@ -0,0 +1,93 @@
|
||||
(function() {
|
||||
var jsdoc,
|
||||
doclets;
|
||||
|
||||
JSpec.describe('@namespace', function() {
|
||||
|
||||
before_each(function() {
|
||||
// docsets can only be created by parsers
|
||||
jsdoc = {
|
||||
tag: require('jsdoc/tag'),
|
||||
parser: require('jsdoc/parser')
|
||||
};
|
||||
jsdoc.parser.parseFiles(BASEDIR + 'test/tests/11_tag_namespace.js');
|
||||
doclets = jsdoc.parser.result;
|
||||
});
|
||||
|
||||
describe('A doclet from a namespace tag with a name tag and no code', function() {
|
||||
it('should have an `isa` property set to "namespace"', function() {
|
||||
var doclet = doclets[0].toObject();
|
||||
expect(doclet).to(have_property, 'isa');
|
||||
expect(doclet.isa).to(eql, 'namespace');
|
||||
});
|
||||
|
||||
it('should have a `name` property set to the given name"', function() {
|
||||
var doclet = doclets[0].toObject();
|
||||
expect(doclet).to(have_property, 'name');
|
||||
expect(doclet.name).to(eql, 'foo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('A doclet from a named namespace tag and no code', function() {
|
||||
it('should have an `isa` property set to "namespace"', function() {
|
||||
var doclet = doclets[1].toObject();
|
||||
expect(doclet).to(have_property, 'isa');
|
||||
expect(doclet.isa).to(eql, 'namespace');
|
||||
});
|
||||
|
||||
it('should have a `name` property set to the given name"', function() {
|
||||
var doclet = doclets[1].toObject();
|
||||
expect(doclet).to(have_property, 'name');
|
||||
expect(doclet.name).to(eql, 'bar');
|
||||
});
|
||||
});
|
||||
|
||||
describe('A doclet from a namespace tag and named code', function() {
|
||||
it('should have an `isa` property set to "namespace"', function() {
|
||||
var doclet = doclets[2].toObject();
|
||||
expect(doclet).to(have_property, 'isa');
|
||||
expect(doclet.isa).to(eql, 'namespace');
|
||||
});
|
||||
|
||||
it('should have a `name` property set to the given name"', function() {
|
||||
var doclet = doclets[2].toObject();
|
||||
expect(doclet).to(have_property, 'name');
|
||||
expect(doclet.name).to(eql, 'pez');
|
||||
});
|
||||
});
|
||||
|
||||
describe('A doclet from a namespace tag and named anonymous function', function() {
|
||||
it('should have an `isa` property set to "namespace"', function() {
|
||||
var doclet = doclets[3].toObject();
|
||||
expect(doclet).to(have_property, 'isa');
|
||||
expect(doclet.isa).to(eql, 'namespace');
|
||||
});
|
||||
|
||||
it('should have a `name` property set to the given name"', function() {
|
||||
var doclet = doclets[3].toObject();
|
||||
expect(doclet).to(have_property, 'name');
|
||||
expect(doclet.name).to(eql, 'qux');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
(function testarea() {
|
||||
|
||||
/**
|
||||
@name foo
|
||||
@namespace
|
||||
*/
|
||||
|
||||
/**
|
||||
@namespace bar
|
||||
*/
|
||||
|
||||
/** @namespace */
|
||||
pez = {
|
||||
}
|
||||
|
||||
/** @namespace */
|
||||
var qux = function() { }
|
||||
})();
|
||||
Loading…
x
Reference in New Issue
Block a user