Added tests for jsdoc.parser.

This commit is contained in:
Michael Mathews 2010-06-27 21:24:20 +01:00
parent f6f962e847
commit 1a6a90320e
2 changed files with 45 additions and 0 deletions

View File

@ -1,5 +1,6 @@
load(BASEDIR + '/test/tests/01_jsdoc_opts.js');
load(BASEDIR + '/test/tests/02_jsdoc_src.js');
load(BASEDIR + '/test/tests/03_jsdoc_parser.js');
// see http://visionmedia.github.com/jspec/
JSpec.run({

View File

@ -0,0 +1,44 @@
(function() {
var jsdoc;
JSpec.describe('jsdoc/parser.js', function() {
before_each(function() {
jsdoc = { parser: require('jsdoc/parser') };
});
describe('The object exported by the jsdoc/src module', function() {
it('should be an object', function() {
expect(jsdoc.parser).to(be_an, Object);
});
it('should have a `parseFiles` method', function() {
expect(jsdoc.parser).to(respond_to, 'parseFiles');
});
});
describe('The jsdoc.parser.result value', function() {
it('should initially be an empty array', function() {
expect(jsdoc.parser.result).to(be_an, Array);
expect(jsdoc.parser.result).to(have_length, 0);
});
it('should be set by calling jsdoc.parser.parseFiles', function() {
jsdoc.parser.parseFiles(BASEDIR + 'test/tests/03_jsdoc_parser.js');
expect(jsdoc.parser.result).to(be_an, Array);
expect(jsdoc.parser.result).to(have_length, 1);
});
it('should be set be populated by doclets', function() {
jsdoc.parser.parseFiles(BASEDIR + 'test/tests/03_jsdoc_parser.js');
expect(jsdoc.parser.result[0].constructor.name).to(eql, 'Doclet');
});
});
});
})();
(function testarea() {
/** @constructor Foo */
})();