Skip to content

Commit

Permalink
Merge 4a38d88 into 11daf39
Browse files Browse the repository at this point in the history
  • Loading branch information
hphamid committed Aug 7, 2016
2 parents 11daf39 + 4a38d88 commit ed9c4fa
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function getRawAnnotations(fileContent, type, name){
module: ['module\\.exports\\s*=\\s*{']
})[type];

var regex = new RegExp('((\\/\\/.*)|(\\/\\*[\\S\\s]*\\*\\/)|\\s)*(' + suffixes.join('|') + ')');
var regex = new RegExp('((\\/\\/.*)|(\\/\\*(?:[\\s\\S](?!\\*\\/))*?\\s*\\*\\/)|\\s)*(' + suffixes.join('|') + ')');

var matches = regex.exec(fileContent);

Expand Down
50 changes: 50 additions & 0 deletions test/object-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ describe('module exposing an object', function(){
result.functions.functionWithMultipleLineAnnotation.rawAnnotations.should.have.property('MultipleLine', ['MultipleLine()']);
});

it('should not get the module annotation', function(){
result.functions.functionWithMultipleLineAnnotation.annotations.should.not.have.property('testModuleMultiline');
});

it('should not get the module rawannotation', function(){
result.functions.functionWithMultipleLineAnnotation.rawAnnotations.should.not.have.property('testModuleMultiline', ['testModuleMultiline()']);
});

it('should have the function reference', function(){
result.functions.functionWithMultipleLineAnnotation.ref().should.be.equal('MultipleLine');
});
Expand Down Expand Up @@ -127,6 +135,24 @@ describe('module exposing an object', function(){
result.functions.functionWithALotOfAnnotation.rawAnnotations.should.have.property('Test3', ['Test3()']);
});

it('should not get the module annotation', function(){
result.functions.functionWithALotOfAnnotation.annotations.should.not.have.property('testModuleMultiline');
});

it('should not get the module rawannotation', function(){
result.functions.functionWithALotOfAnnotation.rawAnnotations.should.not.have.property('testModuleMultiline', ['testModuleMultiline()']);
});

it('should not get the functionWithMultipleLineAnnotation annotation', function(){
result.functions.functionWithALotOfAnnotation.annotations.should.not.have.property('MultipleLine');
});

it('should not get the functionWithMultipleLineAnnotation rawannotation', function(){
result.functions.functionWithALotOfAnnotation.rawAnnotations.should.not.have.property('MultipleLine', ['MultipleLine()']);
});



it('should have the function reference', function(){
result.functions.functionWithALotOfAnnotation.ref().should.be.equal('ALot');
});
Expand Down Expand Up @@ -262,6 +288,14 @@ describe('module exposing an object', function(){
result.functions.functionWithMultipleLineAnnotation.rawAnnotations.should.have.property('MultipleLine', ['MultipleLine()']);
});

it('should not get the module annotation', function(){
result.functions.functionWithMultipleLineAnnotation.annotations.should.not.have.property('testModuleMultiline');
});

it('should not get the module rawannotation', function(){
result.functions.functionWithMultipleLineAnnotation.rawAnnotations.should.not.have.property('testModuleMultiline', ['testModuleMultiline()']);
});

it('should have the function reference', function(){
result.functions.functionWithMultipleLineAnnotation.ref().should.be.equal('MultipleLine');
});
Expand Down Expand Up @@ -297,6 +331,22 @@ describe('module exposing an object', function(){
result.functions.functionWithALotOfAnnotation.rawAnnotations.should.have.property('Test3', ['Test3()']);
});

it('should not get the module annotation', function(){
result.functions.functionWithALotOfAnnotation.annotations.should.not.have.property('testModuleMultiline');
});

it('should not get the module rawannotation', function(){
result.functions.functionWithALotOfAnnotation.rawAnnotations.should.not.have.property('testModuleMultiline', ['testModuleMultiline()']);
});

it('should not get the functionWithMultipleLineAnnotation annotation', function(){
result.functions.functionWithALotOfAnnotation.annotations.should.not.have.property('MultipleLine');
});

it('should not get the functionWithMultipleLineAnnotation rawannotation', function(){
result.functions.functionWithALotOfAnnotation.rawAnnotations.should.not.have.property('MultipleLine', ['MultipleLine()']);
});

it('should have the function reference', function(){
result.functions.functionWithALotOfAnnotation.ref().should.be.equal('ALot');
});
Expand Down

0 comments on commit ed9c4fa

Please sign in to comment.