Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added alternative @return directive.

We should also support @returns the same way as @return.
  • Loading branch information...
commit b8ffe49914a3975b868fa7ff9656f8937443caba 1 parent 98ef26e
@tomaz authored
View
4 Application/GBCommentComponentsProvider.m
@@ -83,7 +83,7 @@ - (NSString *)methodGroupRegex {
}
- (NSString *)argumentsCommonRegex {
- GBRETURN_ON_DEMAND(@"\\s*\\S(param|exception|return|see|sa)\\s+");
+ GBRETURN_ON_DEMAND(@"\\s*\\S(param|exception|return|returns|see|sa)\\s+");
}
- (NSString *)argumentsMatchingRegex {
@@ -99,7 +99,7 @@ - (NSString *)parameterDescriptionRegex {
}
- (NSString *)returnDescriptionRegex {
- GBRETURN_ON_DEMAND([self descriptionCaptureRegexForKeyword:@"return"]);
+ GBRETURN_ON_DEMAND([self descriptionCaptureRegexForKeyword:@"(?:return|returns)"]);
}
- (NSString *)exceptionDescriptionRegex {
View
5 Model/GBComment.h
@@ -79,7 +79,10 @@
/** The first paragraph from `paragraphs` list or `nil` if no paragraph is registered.
- The value is automatically returned from `paragraphs` list, it doesn't have to be manually registered. However if needed, it can still be set manually if needed.
+ The value is automatically set when registering paragraphs, although it can be changed if needed. By default the value is set to the first paragraph registered.
+
+ @see registerParagraph:
+ @see paragraphs
*/
@property (retain) GBCommentParagraph *firstParagraph;
View
11 Testing/GBCommentsProcessor-MethodArgumentsTesting.m
@@ -313,6 +313,17 @@ - (void)testProcesCommentWithStore_return_shouldUseLastResultIfMultipleDetected2
[self assertParagraph:comment.result containsTexts:@"Description2", nil];
}
+- (void)testProcesCommentWithStore_return_shouldDetectAlternativeDirective {
+ // setup
+ GBCommentsProcessor *processor = [GBCommentsProcessor processorWithSettingsProvider:[GBTestObjectsRegistry mockSettingsProvider]];
+ GBComment *comment = [GBComment commentWithStringValue:@"@returns Description"];
+ // execute
+ [processor processComment:comment withStore:[GBTestObjectsRegistry store]];
+ // verify - note that we would get a warning normally as current context doesn't point to a method!
+ assertThatInteger([comment.paragraphs count], equalToInteger(0));
+ [self assertParagraph:comment.result containsTexts:@"Description", nil];
+}
+
#pragma mark Cross reference values testing
- (void)testProcesCommentWithStore_crossref_requiresEmptyLineBeforePreceedingParagraph {
Please sign in to comment.
Something went wrong with that request. Please try again.