Skip to content

Commit

Permalink
Refined top level objects cross references detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaz committed Dec 3, 2012
1 parent 8fe2ce5 commit 41f1e9c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
33 changes: 33 additions & 0 deletions AppledocTests/Processing/DetectCrossReferencesTaskTests.mm
Expand Up @@ -174,6 +174,28 @@ static id setupSection(id section, NSString *first ...) {
builder should equal(GBReplace(@"[$$](%%)"));
});
});

it(@"should detect inside sentence", ^{
runWithDefaultObjects(^(DetectCrossReferencesTask *task, id store, id builder) {
// setup
NSString *text = GBReplace(@"prefix $$\tsuffix");
// execute
[task processCrossRefsInString:text toBuilder:builder];
// verify
builder should equal(GBReplace(@"prefix [$$](%%)\tsuffix"));
});
});

it(@"should detect all references", ^{
runWithDefaultObjects(^(DetectCrossReferencesTask *task, id store, id builder) {
// setup
NSString *text = GBReplace(@"prefix $$ and $$ end");
// execute
[task processCrossRefsInString:text toBuilder:builder];
// verify
builder should equal(GBReplace(@"prefix [$$](%%) and [$$](%%) end"));
});
});
});

describe(@"classes:", ^{
Expand Down Expand Up @@ -207,6 +229,17 @@ static id setupSection(id section, NSString *first ...) {
});
itShouldBehaveLike(@"examples");
});

it(@"should detect mixed cases", ^{
runWithDefaultObjects(^(DetectCrossReferencesTask *task, id store, id builder) {
// setup
NSString *text = @"MyClass MyClass() MyClass(MyCategory) MyProtocol";
// execute
[task processCrossRefsInString:text toBuilder:builder];
// verify
builder should equal(@"[MyClass]($CLASSES/MyClass.$EXT) [MyClass()]($CATEGORIES/MyClass.$EXT) [MyClass(MyCategory)]($CATEGORIES/MyClass(MyCategory).$EXT) [MyProtocol]($PROTOCOLS/MyProtocol.$EXT)");
});
});
});
});

Expand Down
1 change: 1 addition & 0 deletions appledoc/Processing/DetectCrossReferencesTask.m
Expand Up @@ -86,6 +86,7 @@ - (void)processInlineCrossRefsInString:(NSString *)string toBuilder:(NSMutableSt
[builder appendString:[bself stringForCrossRefTo:object description:word]];
return;
}
[builder appendString:word];
} match:^(NSTextCheckingResult *match) {
[builder appendString:[match gb_stringAtIndex:0 in:string]];
}];
Expand Down

0 comments on commit 41f1e9c

Please sign in to comment.