From dbc9c428a6cf0c2f1bccb67ba585de57ee9ab0f0 Mon Sep 17 00:00:00 2001 From: Michael Mathews Date: Sat, 24 Sep 2011 08:26:00 +0100 Subject: [PATCH] Fix for broken /*!* test. (hat tip tschaub) --- rhino_modules/jsdoc/src/parser.js | 2 +- test/cases/starbangstar.js | 9 +++++++-- test/t/cases/starbangstar.js | 9 +++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/rhino_modules/jsdoc/src/parser.js b/rhino_modules/jsdoc/src/parser.js index b2fa3710..0bca33a9 100644 --- a/rhino_modules/jsdoc/src/parser.js +++ b/rhino_modules/jsdoc/src/parser.js @@ -122,7 +122,7 @@ function pretreat(code) { // make lent objectliterals documentable by giving them a dummy name .replace(/(\/\*\*[\s\S]*?@lends\b[\s\S]*?\*\/\s*)\{/g, '$1____ = {') // make starbangstar comments look like real jsdoc comments - .replace(/\/\*\!\*/g, '/***'); + .replace(/\/\*\!\*/g, '/**'); } /** diff --git a/test/cases/starbangstar.js b/test/cases/starbangstar.js index a0456352..262da969 100644 --- a/test/cases/starbangstar.js +++ b/test/cases/starbangstar.js @@ -1,7 +1,12 @@ -/** +/*!* * Script that does something awesome * * @copyright (c) 2011 Rotorz Limited. All rights reserved. * @author Lea Hayes * @module myscript/core -*/ \ No newline at end of file +*/ + +/*!********************************* + * This should be ignored by JSDoc + * @var x + */ \ No newline at end of file diff --git a/test/t/cases/starbangstar.js b/test/t/cases/starbangstar.js index 0f040ff5..811aa370 100644 --- a/test/t/cases/starbangstar.js +++ b/test/t/cases/starbangstar.js @@ -1,9 +1,14 @@ (function() { var docSet = testhelpers.getDocSetFromFile('test/cases/starbangstar.js'), - mod = docSet.getByLongname('module:myscript/core')[0]; - + mod = docSet.getByLongname('module:myscript/core')[0], + x = docSet.getByLongname('module:myscript/core.x')[0]; + test('When doclet starts wuth /*!* it, it is treated as a JSDoc comment.', function() { assert.equal(mod.description, 'Script that does something awesome'); }); + + test('When doclet starts wuth /*!** it, it is not treated as a JSDoc comment.', function() { + assert.equal(typeof x, 'undefined'); + }); })(); \ No newline at end of file