mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added test case for multiple parses to check that parser state is reset each time. Fixed issue with nodeunit and settimeout that caused tests to run in random order, sometimes before the last test completed!
This commit is contained in:
parent
4ed02965ed
commit
7cce83c928
@ -559,10 +559,11 @@ var reporter = {};
|
||||
|
||||
//// exported async module functions ////
|
||||
|
||||
//// nextTick implementation with browser-compatible fallback ////
|
||||
//// nextTick implementation with browser and rhino-compatible fallbacks ////
|
||||
async.nextTick = function(fn){
|
||||
if(typeof process == 'undefined' || !(process.nextTick)){
|
||||
setTimeout(fn, 0);
|
||||
if (typeof window !== 'undefined' && window.setTimeout) setTimeout(fn, 0);
|
||||
else fn();
|
||||
}
|
||||
else process.nextTick(fn);
|
||||
};
|
||||
@ -1747,7 +1748,7 @@ exports.run = function (modules, options) {
|
||||
' assertions (' + assertions.duration + 'ms)</h3>';
|
||||
}
|
||||
if (typeof document === 'undefined' && typeof print !== 'undefined') {
|
||||
return print( html.replace(/<li class="pass">/g, '\033[1;032m√ \033[0m').replace(/<li class="fail">/g, '\033[1;031mX \033[0m').replace(/<h\d>/g, "\n").replace(/<\/h\d>/g, "\n").replace(/<div class="assertion_message">/g, "\n ").replace(/<\/(li|div)>/g, "\n").replace(/<[^>]+?>/g, '') );
|
||||
return print( html.replace(/<li class="pass">/g, '(/) ').replace(/<li class="fail">/g, '(X) ').replace(/<h\d>/g, "\n").replace(/<\/h\d>/g, "\n").replace(/<div class="assertion_message">/g, "\n ").replace(/<\/(li|div)>/g, "\n").replace(/<[^>]+?>/g, '') );
|
||||
}
|
||||
document.body.innerHTML += html;
|
||||
}
|
||||
|
||||
6
node_modules/jsdoc/parser.js
generated
vendored
6
node_modules/jsdoc/parser.js
generated
vendored
@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
var path,
|
||||
symbols = 'wtf';
|
||||
symbols = null;
|
||||
|
||||
exports.parse = function(src) {
|
||||
symbols = [];
|
||||
@ -40,8 +40,8 @@
|
||||
|
||||
var handle = {
|
||||
JSDOC: function(jsdoc) {
|
||||
//console.log( '>>> jsdoc "'+jsdoc+'"' );
|
||||
symbols.push( new Doclet(jsdoc, {longname: ''}) );
|
||||
//print( '>>> jsdoc "'+jsdoc+'"' );
|
||||
symbols.push( new Doclet(jsdoc, {longname: ''}) );
|
||||
},
|
||||
VAR: function(node) {
|
||||
var child = null,
|
||||
|
||||
@ -36,3 +36,14 @@ exports['Parse a source with only single non-jsdoc multi-line comments.'] = func
|
||||
t.equal( docs.length, 0, 'should result in docs that are empty' );
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports['Parse second source, should be unaffected by the first pasre.'] = function(t) {
|
||||
t.expect(2);
|
||||
var docs = parser.parse('/**@doc1*/ /**@doc2*/ var x;');
|
||||
t.equal( docs.length, 2 );
|
||||
|
||||
docs = parser.parse('function y(){}');
|
||||
t.equal( docs.length, 1 );
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user