jsdoc/test/jsdoc_parser_comments.js
2011-05-07 15:16:47 +01:00

39 lines
1.2 KiB
JavaScript

var parser = require('jsdoc/parser');
var dumper = require('jsdoc/util/dumper');
exports['Parse a source containing only a jsdoc comment.'] = function(t) {
t.expect(1);
var docs = parser.parse('/**@doc*/');
t.equal( docs.length, 1, 'should result in docs that contain the comment' );
t.done();
};
exports['Parse a source ending with a jsdoc comment.'] = function(t) {
t.expect(1);
var docs = parser.parse(';/**@doc*/');
t.equal( docs.length, 1, 'should result in docs that contain the comment' );
t.done();
};
exports['Parse a source with a jsdoc comment preceding a jsdoc comment.'] = function(t) {
t.expect(1);
var docs = parser.parse('/**@doc1*/ /**@doc2*/ var x;');
t.equal( docs.length, 2, 'should result in docs containing both the comments' );
t.done();
};
exports['Parse a source with only single line comments.'] = function(t) {
t.expect(1);
var docs = parser.parse('// foo');
t.equal( docs.length, 0, 'should result in docs that are empty' );
t.done();
};
exports['Parse a source with only single non-jsdoc multi-line comments.'] = function(t) {
t.expect(1);
var docs = parser.parse('/*foo*/');
t.equal( docs.length, 0, 'should result in docs that are empty' );
t.done();
};