Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implemented optional required escaping for cross references. Closes #8.

The issue was that user had no way of being explicit about which word should be considered cross reference and which not. Result was that any word that was also valid cross reference was converted to one. This lead to unexpected references being created from normal words - like "paragraphs" and similar.

The user now has two choices regarding cross references: power users can provide their own cross references markers template regex, while simpler choice is to turn on explicit cross references detection. Actually this sets default markers template under the hood, so the two options should not be used together.
  • Loading branch information...
commit 52f5e8b71b93198a1c930fe426278ed05b874b5b 1 parent 19fe979
tomaz authored
15 Application/GBAppledocApplication.m
View
@@ -41,6 +41,9 @@
static NSString *kGBArgKeepMergedCategoriesSections = @"keep-merged-sections";
static NSString *kGBArgPrefixMergedCategoriesSectionsWithCategoryName = @"prefix-merged-sections";
+static NSString *kGBArgExplicitCrossRef = @"explicit-crossref";
+static NSString *kGBArgCrossRefFormat = @"crossref-format";
+
static NSString *kGBArgWarnOnMissingOutputPath = @"warn-missing-output-path";
static NSString *kGBArgWarnOnMissingCompanyIdentifier = @"warn-missing-company-id";
static NSString *kGBArgWarnOnUndocumentedObject = @"warn-undocumented-object";
@@ -226,6 +229,10 @@ - (void)application:(DDCliApplication *)app willParseOptions:(DDGetoptLongParser
{ GBNoArg(kGBArgInstallDocSet), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgPublishDocSet), 0, DDGetoptNoArgument },
+ { kGBArgCrossRefFormat, 0, DDGetoptRequiredArgument },
+ { kGBArgExplicitCrossRef, 0, DDGetoptNoArgument },
+ { GBNoArg(kGBArgExplicitCrossRef), 0, DDGetoptNoArgument },
+
{ kGBArgKeepIntermediateFiles, 0, DDGetoptNoArgument },
{ kGBArgKeepUndocumentedObjects, 0, DDGetoptNoArgument },
{ kGBArgKeepUndocumentedMembers, 0, DDGetoptNoArgument },
@@ -460,6 +467,10 @@ - (void)setNoCreateDocset:(BOOL)value { self.settings.createDocSet = !value; }
- (void)setNoInstallDocset:(BOOL)value { self.settings.installDocSet = !value; }
- (void)setNoPublishDocset:(BOOL)value { self.settings.publishDocSet = !value; }
+- (void)setCrossrefFormat:(NSString *)value { self.settings.commentComponents.crossReferenceMarkersTemplate = value; }
+- (void)setExplicitCrossref:(BOOL)value { self.settings.commentComponents.crossReferenceMarkersTemplate = @"<%@>"; }
+- (void)setNoExplicitCrossref:(BOOL)value { self.settings.commentComponents.crossReferenceMarkersTemplate = @"<?%@>?"; }
+
- (void)setKeepIntermediateFiles:(BOOL)value { self.settings.keepIntermediateFiles = value;}
- (void)setKeepUndocumentedObjects:(BOOL)value { self.settings.keepUndocumentedObjects = value; }
- (void)setKeepUndocumentedMembers:(BOOL)value { self.settings.keepUndocumentedMembers = value; }
@@ -582,6 +593,7 @@ - (void)printSettingsAndArguments:(NSArray *)arguments {
ddprintf(@"--%@ = %@\n", kGBArgMergeCategoriesToClasses, PRINT_BOOL(self.settings.mergeCategoriesToClasses));
ddprintf(@"--%@ = %@\n", kGBArgKeepMergedCategoriesSections, PRINT_BOOL(self.settings.keepMergedCategoriesSections));
ddprintf(@"--%@ = %@\n", kGBArgPrefixMergedCategoriesSectionsWithCategoryName, PRINT_BOOL(self.settings.prefixMergedCategoriesSectionsWithCategoryName));
+ ddprintf(@"--%@ = %@\n", kGBArgCrossRefFormat, self.settings.commentComponents.crossReferenceMarkersTemplate);
ddprintf(@"\n");
ddprintf(@"--%@ = %@\n", kGBArgWarnOnMissingOutputPath, PRINT_BOOL(self.settings.warnOnMissingOutputPathArgument));
@@ -639,6 +651,8 @@ - (void)printHelp {
PRINT_USAGE(@" ", kGBArgMergeCategoriesToClasses, @"", @"[b] Merge categories to classes");
PRINT_USAGE(@" ", kGBArgKeepMergedCategoriesSections, @"", @"[b] Keep merged categories sections");
PRINT_USAGE(@" ", kGBArgPrefixMergedCategoriesSectionsWithCategoryName, @"", @"[b] Prefix merged sections with category name");
+ PRINT_USAGE(@" ", kGBArgExplicitCrossRef, @"", @"[b] Shortcut for explicit default cross ref template");
+ PRINT_USAGE(@" ", kGBArgCrossRefFormat, @"<string>", @"Cross reference template regex");
ddprintf(@"\n");
ddprintf(@"WARNINGS\n");
PRINT_USAGE(@" ", kGBArgWarnOnMissingOutputPath, @"", @"[b] Warn if output path is not given");
@@ -715,4 +729,3 @@ - (void)printHelpForShortOption:(NSString *)aShort longOption:(NSString *)aLong
}
@end
-
50 Application/GBCommentComponentsProvider.h
View
@@ -96,20 +96,50 @@
/// @name Cross references definitions
///---------------------------------------------------------------------------------------
-/** Returns the regex used for matching (possible) remote member cross references with capture 1 containing object name and capture 2 member name. */
-@property (readonly) NSString *remoteMemberCrossReferenceRegex;
+/** Returns the regex used for matching (possible) remote member cross references with capture 1 containing object name and capture 2 member name.
+
+ The result of the method depends on the templated value: if the value is `YES`, the string includes template from `crossReferenceMarkersTemplate`, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for `crossReferenceRegex` matching.
+
+ @param templates If `YES` templated regex is returned, otherwise pure one.
+ @return Returns the regex used for matching cross reference.
+ */
+- (NSString *)remoteMemberCrossReferenceRegex:(BOOL)templated;
-/** Returns the regex used for matching (possible) local member cross reference with capture 1 containing member name. */
-@property (readonly) NSString *localMemberCrossReferenceRegex;
+/** Returns the regex used for matching (possible) local member cross reference with capture 1 containing member name.
+
+ The result of the method depends on the templated value: if the value is `YES`, the string includes template from `crossReferenceMarkersTemplate`, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for `crossReferenceRegex` matching.
+
+ @param templates If `YES` templated regex is returned, otherwise pure one.
+ @return Returns the regex used for matching cross reference.
+ */
+- (NSString *)localMemberCrossReferenceRegex:(BOOL)templated;
-/** Returns the regex used for matching (possible) category cross reference with capture 1 containing category name. */
-@property (readonly) NSString *categoryCrossReferenceRegex;
+/** Returns the regex used for matching (possible) category cross reference with capture 1 containing category name.
+
+ The result of the method depends on the templated value: if the value is `YES`, the string includes template from `crossReferenceMarkersTemplate`, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for `crossReferenceRegex` matching.
+
+ @param templates If `YES` templated regex is returned, otherwise pure one.
+ @return Returns the regex used for matching cross reference.
+ */
+- (NSString *)categoryCrossReferenceRegex:(BOOL)templated;
-/** Returns the regex used for matching (possible) class or protocol cross reference with capture 1 containing object name. */
-@property (readonly) NSString *objectCrossReferenceRegex;
+/** Returns the regex used for matching (possible) class or protocol cross reference with capture 1 containing object name.
+
+ The result of the method depends on the templated value: if the value is `YES`, the string includes template from `crossReferenceMarkersTemplate`, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for `crossReferenceRegex` matching.
+
+ @param templates If `YES` templated regex is returned, otherwise pure one.
+ @return Returns the regex used for matching cross reference.
+ */
+- (NSString *)objectCrossReferenceRegex:(BOOL)templated;
-/** Returns the regex used for matching URL cross reference with caption 1 contining the URL itself. */
-@property (readonly) NSString *urlCrossReferenceRegex;
+/** Returns the regex used for matching URL cross reference with caption 1 contining the URL itself.
+
+ The result of the method depends on the templated value: if the value is `YES`, the string includes template from `crossReferenceMarkersTemplate`, otherwise it only contains "pure" regex. The first option should be used for in-text cross references detection, while the second for `crossReferenceRegex` matching.
+
+ @param templates If `YES` templated regex is returned, otherwise pure one.
+ @return Returns the regex used for matching cross reference.
+ */
+- (NSString *)urlCrossReferenceRegex:(BOOL)templated;
///---------------------------------------------------------------------------------------
/// @name Common definitions
40 Application/GBCommentComponentsProvider.m
View
@@ -103,25 +103,45 @@ - (NSString *)crossReferenceRegex {
#pragma mark Cross references detection
-- (NSString *)remoteMemberCrossReferenceRegex {
+- (NSString *)remoteMemberCrossReferenceRegex:(BOOL)templated {
// +[Class member] or -[Class member] or simply [Class member].
- GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:@"[+-]?\\[(\\S+)\\s+(\\S+)\\]"]);
+ if (templated) {
+ GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:[self remoteMemberCrossReferenceRegex:NO]]);
+ } else {
+ GBRETURN_ON_DEMAND(@"[+-]?\\[(\\S+)\\s+(\\S+)\\]");
+ }
}
-- (NSString *)localMemberCrossReferenceRegex {
- GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:@"([^>,.;!?()\\s]+)"]);
+- (NSString *)localMemberCrossReferenceRegex:(BOOL)templated {
+ if (templated) {
+ GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:[self localMemberCrossReferenceRegex:NO]]);
+ } else {
+ GBRETURN_ON_DEMAND(@"([^>,.;!?()\\s]+)");
+ }
}
-- (NSString *)categoryCrossReferenceRegex {
- GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:@"([^(][^>,.:;!?)\\s]+\\))"]);
+- (NSString *)categoryCrossReferenceRegex:(BOOL)templated {
+ if (templated) {
+ GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:[self categoryCrossReferenceRegex:NO]]);
+ } else {
+ GBRETURN_ON_DEMAND(@"([^(][^>,.:;!?)\\s]+\\))");
+ }
}
-- (NSString *)objectCrossReferenceRegex {
- GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:@"([^>,.:;!?()\\s]+)"]);
+- (NSString *)objectCrossReferenceRegex:(BOOL)templated {
+ if (templated) {
+ GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:[self objectCrossReferenceRegex:NO]]);
+ } else {
+ GBRETURN_ON_DEMAND(@"([^>,.:;!?()\\s]+)");
+ }
}
-- (NSString *)urlCrossReferenceRegex {
- GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:@"(\\b(?:mailto\\:|(?:https?|ftps?|news|rss|file)\\://)[a-zA-Z0-9@:\\-.]+(?::(\\d+))?(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)?)"]);
+- (NSString *)urlCrossReferenceRegex:(BOOL)templated {
+ if (templated) {
+ GBRETURN_ON_DEMAND([self crossReferenceRegexForRegex:[self urlCrossReferenceRegex:NO]]);
+ } else {
+ GBRETURN_ON_DEMAND(@"(\\b(?:mailto\\:|(?:https?|ftps?|news|rss|file)\\://)[a-zA-Z0-9@:\\-.]+(?::(\\d+))?(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)?)");
+ }
}
#pragma mark Common detection
56 Processing/GBCommentsProcessor.m
View
@@ -27,13 +27,13 @@ - (void)registerTextBlockFromLines:(NSArray *)lines;
- (void)registerTextItemsFromStringToCurrentParagraph:(NSString *)string;
- (void)registerTextAndLinkItemsFromString:(NSString *)string toObject:(id)object;
-- (id)linkItemFromString:(NSString *)string range:(NSRange *)range description:(NSString **)description;
-- (id)remoteMemberLinkItemFromString:(NSString *)string range:(NSRange *)range;
-- (id)localMemberLinkFromString:(NSString *)string range:(NSRange *)range;
-- (id)classLinkFromString:(NSString *)string range:(NSRange *)range;
-- (id)categoryLinkFromString:(NSString *)string range:(NSRange *)range;
-- (id)protocolLinkFromString:(NSString *)string range:(NSRange *)range;
-- (id)urlLinkItemFromString:(NSString *)string range:(NSRange *)range;
+- (id)linkItemFromString:(NSString *)string range:(NSRange *)range description:(NSString **)description templated:(BOOL)templated;
+- (id)remoteMemberLinkItemFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated;
+- (id)localMemberLinkFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated;
+- (id)classLinkFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated;
+- (id)categoryLinkFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated;
+- (id)protocolLinkFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated;
+- (id)urlLinkItemFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated;
- (GBCommentParagraph *)pushParagraphIfStackIsEmpty;
- (GBCommentParagraph *)pushParagraph:(BOOL)canAutoRegister;
@@ -417,7 +417,7 @@ - (BOOL)registerDirectivesBlockFromLines:(NSArray *)lines {
components = [directive captureComponentsMatchedByRegex:crossRefRegex];
if ([components count] > 0) {
NSString *text = [components objectAtIndex:1];
- GBParagraphLinkItem *item = [self linkItemFromString:text range:nil description:nil];
+ GBParagraphLinkItem *item = [self linkItemFromString:text range:nil description:nil templated:NO];
if (item) {
GBLogDebug(@" - Matched cross ref directive %@ at %@...", text, sourceInfo);
[self.currentComment registerCrossReference:item];
@@ -536,7 +536,7 @@ - (void)registerTextAndLinkItemsFromString:(NSString *)string toObject:(id)objec
while ([string length] > 0) {
// If the string starts with any recognized cross reference, add the link item and skip it's text, otherwise mark the word until next whitespace as text item.
NSString *description = nil;
- GBParagraphLinkItem *linkItem = [self linkItemFromString:string range:&range description:&description];
+ GBParagraphLinkItem *linkItem = [self linkItemFromString:string range:&range description:&description templated:YES];
if (linkItem) {
skipTextFromString([string substringToIndex:range.location]);
registerTextItemFromString(text);
@@ -556,31 +556,31 @@ - (void)registerTextAndLinkItemsFromString:(NSString *)string toObject:(id)objec
#pragma mark Cross references detection
-- (id)linkItemFromString:(NSString *)string range:(NSRange *)range description:(NSString **)description {
+- (id)linkItemFromString:(NSString *)string range:(NSRange *)range description:(NSString **)description templated:(BOOL)templated {
// Matches any cross reference at the start of the given string and creates GBParagraphLinkItem, match range and description suitable for logging if found. If the string doesn't represent any known cross reference, nil is returned and the other parameters are left untouched. Note that the order of testing is somewhat important (for example we should test for category before class or protocol to avoid text up to open parenthesis being recognized as a class where in fact it's category).
GBParagraphLinkItem *result = nil;
NSString *desc = nil;
- if ((result = [self categoryLinkFromString:string range:range])) {
+ if ((result = [self categoryLinkFromString:string range:range templated:templated])) {
desc = @"category";
- } else if ((result = [self classLinkFromString:string range:range])) {
+ } else if ((result = [self classLinkFromString:string range:range templated:templated])) {
desc = @"class";
- } else if ((result = [self protocolLinkFromString:string range:range])) {
+ } else if ((result = [self protocolLinkFromString:string range:range templated:templated])) {
desc = @"protocol";
- } else if ((result = [self remoteMemberLinkItemFromString:string range:range])) {
+ } else if ((result = [self remoteMemberLinkItemFromString:string range:range templated:templated])) {
desc = @"remote member";
- } else if ((result = [self localMemberLinkFromString:string range:range])) {
+ } else if ((result = [self localMemberLinkFromString:string range:range templated:templated])) {
desc = @"local member";
- } else if ((result = [self urlLinkItemFromString:string range:range])) {
+ } else if ((result = [self urlLinkItemFromString:string range:range templated:templated])) {
desc = @"url";
}
if (result && description) *description = desc;
return result;
}
-- (id)remoteMemberLinkItemFromString:(NSString *)string range:(NSRange *)range {
+- (id)remoteMemberLinkItemFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated {
// Matches the beginning of the string for remote member cross reference (in the format [Object member]). If found, GBParagraphLinkItem is prepared and returned. NOTE: The range argument is used to return the range of all link text, including optional <> markers.
// If the string starts with remote link
- NSArray *components = [string captureComponentsMatchedByRegex:self.components.remoteMemberCrossReferenceRegex];
+ NSArray *components = [string captureComponentsMatchedByRegex:[self.components remoteMemberCrossReferenceRegex:templated]];
if ([components count] == 0) return nil;
// Get link components. Index 0 contains full text, including optional <>, index 1 object name, index 2 member name.
@@ -619,10 +619,10 @@ - (id)remoteMemberLinkItemFromString:(NSString *)string range:(NSRange *)range {
return result;
}
-- (id)localMemberLinkFromString:(NSString *)string range:(NSRange *)range {
+- (id)localMemberLinkFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated {
// Matches the beginning of the string for local member cross reference. If found, GBParagraphLinkItem is prepared and returned. NOTE: The range argument is used to return the range of all link text, including optional <> markers. NOTE: Note that we can skip local member cross ref testing if no context (i.e. class, category or protocol) is given!
if (!self.currentContext) return nil;
- NSArray *components = [string captureComponentsMatchedByRegex:self.components.localMemberCrossReferenceRegex];
+ NSArray *components = [string captureComponentsMatchedByRegex:[self.components localMemberCrossReferenceRegex:templated]];
if ([components count] == 0) return nil;
// Get link components. Index 0 contains full text, including optional <>, index 1 just the member selector.
@@ -643,9 +643,9 @@ - (id)localMemberLinkFromString:(NSString *)string range:(NSRange *)range {
return result;
}
-- (id)classLinkFromString:(NSString *)string range:(NSRange *)range {
+- (id)classLinkFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated {
// Matches the beginning of the string for class cross reference. If found, GBParagraphLinkItem is prepared and returned. NOTE: The range argument is used to return the range of all link text, including optional <> markers.
- NSArray *components = [string captureComponentsMatchedByRegex:self.components.objectCrossReferenceRegex];
+ NSArray *components = [string captureComponentsMatchedByRegex:[self.components objectCrossReferenceRegex:templated]];
if ([components count] == 0) return nil;
// Get link components. Index 0 contains full text, including optional <>, index 1 just the object name.
@@ -665,9 +665,9 @@ - (id)classLinkFromString:(NSString *)string range:(NSRange *)range {
return result;
}
-- (id)categoryLinkFromString:(NSString *)string range:(NSRange *)range {
+- (id)categoryLinkFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated {
// Matches the beginning of the string for category cross reference. If found, GBParagraphLinkItem is prepared and returned. NOTE: The range argument is used to return the range of all link text, including optional <> markers.
- NSArray *components = [string captureComponentsMatchedByRegex:self.components.categoryCrossReferenceRegex];
+ NSArray *components = [string captureComponentsMatchedByRegex:[self.components categoryCrossReferenceRegex:templated]];
if ([components count] == 0) return nil;
// Get link components. Index 0 contains full text, including optional <>, index 1 just the object name.
@@ -687,9 +687,9 @@ - (id)categoryLinkFromString:(NSString *)string range:(NSRange *)range {
return result;
}
-- (id)protocolLinkFromString:(NSString *)string range:(NSRange *)range {
+- (id)protocolLinkFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated {
// Matches the beginning of the string for protocol cross reference. If found, GBParagraphLinkItem is prepared and returned. NOTE: The range argument is used to return the range of all link text, including optional <> markers.
- NSArray *components = [string captureComponentsMatchedByRegex:self.components.objectCrossReferenceRegex];
+ NSArray *components = [string captureComponentsMatchedByRegex:[self.components objectCrossReferenceRegex:templated]];
if ([components count] == 0) return nil;
// Get link components. Index 0 contains full text, including optional <>, index 1 just the object name.
@@ -709,9 +709,9 @@ - (id)protocolLinkFromString:(NSString *)string range:(NSRange *)range {
return result;
}
-- (id)urlLinkItemFromString:(NSString *)string range:(NSRange *)range {
+- (id)urlLinkItemFromString:(NSString *)string range:(NSRange *)range templated:(BOOL)templated {
// Matches the beginning of the string for URL cross reference. If found, GBParagraphLinkItem is prepared and returned. NOTE: The range argument is used to return the range of all link text, including optional <> markers.
- NSArray *components = [string captureComponentsMatchedByRegex:self.components.urlCrossReferenceRegex];
+ NSArray *components = [string captureComponentsMatchedByRegex:[self.components urlCrossReferenceRegex:templated]];
if ([components count] == 0) return nil;
// Get link components. Index 0 contains full text, including optional <>, index 1 just the URL address.
16 Testing/GBApplicationTesting.m
View
@@ -234,6 +234,22 @@ - (void)testPrefixMergedCategoriesSectionsWithCategoryName_shouldAssignValueToSe
assertThatBool(settings2.prefixMergedCategoriesSectionsWithCategoryName, equalToBool(NO));
}
+- (void)testExplicitCrossRef_shouldAssignValueToSettings {
+ // setup & execute
+ GBApplicationSettingsProvider *settings1 = [self settingsByRunningWithArgs:@"--explicit-crossref", nil];
+ GBApplicationSettingsProvider *settings2 = [self settingsByRunningWithArgs:@"--no-explicit-crossref", nil];
+ // verify
+ assertThat(settings1.commentComponents.crossReferenceMarkersTemplate, is(@"<%@>"));
+ assertThat(settings2.commentComponents.crossReferenceMarkersTemplate, is(@"<?%@>?"));
+}
+
+- (void)testCrossRefFormat_shouldAssignValueToSettings {
+ // setup & execute
+ GBApplicationSettingsProvider *settings = [self settingsByRunningWithArgs:@"--crossref-format", @"FORMAT", nil];
+ // verify
+ assertThat(settings.commentComponents.crossReferenceMarkersTemplate, is(@"FORMAT"));
+}
+
#pragma mark Warnings settings testing
- (void)testWarnOnMissingOutputPath_shouldAssignValueToSettings {
32 Testing/GBCommentComponentsProviderTesting.m
View
@@ -9,20 +9,6 @@
#import "GBApplicationSettingsProvider.h"
#import "GBCommentComponentsProvider.h"
-@interface GBCommentComponentsProvider (TestingAPI)
-- (NSString *)crossReferenceTemplateValue;
-@end
-
-@implementation GBCommentComponentsProvider (TestingAPI)
-
-- (NSString *)crossReferenceTemplateValue {
- return [self valueForKey:@"crossReferenceTemplate"];
-}
-
-@end
-
-#pragma mark -
-
@interface GBCommentComponentsProviderTesting : GHTestCase
@end
@@ -32,23 +18,7 @@ - (void)testInitializer_shouldPrepareOptionalCrossReferencePrefixAndSuffix {
// setup & execute
GBCommentComponentsProvider *provider = [GBCommentComponentsProvider provider];
// verify
- assertThat(provider.crossReferenceTemplateValue, is(@"<?%@>?"));
-}
-
-- (void)testSetCrossReferenceTemplate_shouldChangeCrossReferenceTemplate {
- // setup
- GBCommentComponentsProvider *provider = [GBCommentComponentsProvider provider];
- // execute
- [provider setCrossReferenceMarkers:@"PREFIX%@SUFFIX"];
- // verify
- assertThat(provider.crossReferenceTemplateValue, is(@"PREFIX%@SUFFIX"));
-}
-
-- (void)testSetCrossReferenceTemplate_throwsIfTemplateIsNotGiven {
- // setup
- GBCommentComponentsProvider *provider = [GBCommentComponentsProvider provider];
- // execute & verify
- GHAssertThrows([provider setCrossReferenceMarkers:@"aaaa"], @"");
+ assertThat(provider.crossReferenceMarkersTemplate, is(@"<?%@>?"));
}
@end
Please sign in to comment.
Something went wrong with that request. Please try again.