Skip to content
Browse files

Merge pull request #64 from nopnop/singlelinecomment

Single line comment test and correction
  • Loading branch information...
2 parents d8b3e37 + 431d9d8 commit acb29db147669cff36eb97371767dd2e0500853b @tj committed
Showing with 16 additions and 1 deletion.
  1. +0 −1 lib/dox.js
  2. +9 −0 test/dox.test.js
  3. +7 −0 test/fixtures/singleline.js
View
1 lib/dox.js
@@ -59,7 +59,6 @@ exports.parseComments = function(js, options){
withinMultiline = ignore = false;
buf = '';
} else if (!withinSingle && !withinMultiline && '/' == js[i] && '/' == js[i+1]) {
- i += 2;
withinSingle = true;
buf += js[i];
} else if (withinSingle && !withinMultiline && '\n' == js[i]) {
View
9 test/dox.test.js
@@ -302,4 +302,13 @@ module.exports = {
done();
});
},
+
+ 'test .parseComments() with a simple single line comment in code': function(done){
+ fixture('singleline.js', function(err, str){
+ var comments = dox.parseComments(str)
+ , all = comments.shift();
+ all.code.should.equal("function foo() {\n // Maybe useful\n doSomething();\n}");
+ done();
+ });
+ },
};
View
7 test/fixtures/singleline.js
@@ -0,0 +1,7 @@
+/**
+ * Code below must contain the useful comment
+ */
+function foo() {
+ // Maybe useful
+ doSomething();
+}

0 comments on commit acb29db

Please sign in to comment.
Something went wrong with that request. Please try again.