Permalink
Browse files

Fixed unit tests for handling paths to category files. References #160.

  • Loading branch information...
1 parent f72bbd5 commit 178a2cee2fc040082deabbbfa4869ce309d9bc3e @tomaz committed Dec 24, 2011
@@ -445,7 +445,7 @@ - (NSString *)outputPathForObject:(id)object withExtension:(NSString *)extension
}
else if ([object isKindOfClass:[GBCategoryData class]]) {
basePath = @"Categories";
- name = [NSString stringWithFormat:@"%@+%@", [object nameOfClass], [object nameOfCategory]];
+ name = [NSString stringWithFormat:@"%@+%@", [object nameOfClass], [object nameOfCategory] ? [object nameOfCategory] : @""];
}
else if ([object isKindOfClass:[GBProtocolData class]]) {
basePath = @"Protocols";
@@ -145,8 +145,8 @@ - (void)testHtmlReferenceNameForObject_shouldReturnProperValueForTopLevelObjects
GBProtocolData *protocol = [GBProtocolData protocolDataWithName:@"Protocol"];
// execute & verify
assertThat([settings htmlReferenceNameForObject:class], is(@"Class.html"));
- assertThat([settings htmlReferenceNameForObject:category], is(@"Class(Category).html"));
- assertThat([settings htmlReferenceNameForObject:extension], is(@"Class().html"));
+ assertThat([settings htmlReferenceNameForObject:category], is(@"Class+Category.html"));
+ assertThat([settings htmlReferenceNameForObject:extension], is(@"Class+.html"));
assertThat([settings htmlReferenceNameForObject:protocol], is(@"Protocol.html"));
}
@@ -205,8 +205,8 @@ - (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForCategoryF
GBMethodData *method = [GBTestObjectsRegistry instanceMethodWithNames:@"method", nil];
[category.methods registerMethod:method];
// execute & verify
- assertThat([settings htmlReferenceForObject:category fromSource:nil], is(@"Categories/Class(Category).html"));
- assertThat([settings htmlReferenceForObject:method fromSource:nil], is(@"Categories/Class(Category).html#//api/name/method:"));
+ assertThat([settings htmlReferenceForObject:category fromSource:nil], is(@"Categories/Class+Category.html"));
+ assertThat([settings htmlReferenceForObject:method fromSource:nil], is(@"Categories/Class+Category.html#//api/name/method:"));
}
- (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForProtocolFromIndex {
@@ -252,7 +252,7 @@ - (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForTopLevelO
GBDocumentData *document = [GBDocumentData documentDataWithContents:@"c" path:@"document.ext"];
// execute & verify
assertThat([settings htmlReferenceForObject:class fromSource:class], is(@"Class.html"));
- assertThat([settings htmlReferenceForObject:category fromSource:category], is(@"Class(Category).html"));
+ assertThat([settings htmlReferenceForObject:category fromSource:category], is(@"Class+Category.html"));
assertThat([settings htmlReferenceForObject:protocol fromSource:protocol], is(@"Protocol.html"));
assertThat([settings htmlReferenceForObject:document fromSource:document], is(@"document.html"));
}
@@ -272,8 +272,8 @@ - (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForTopLevelO
// execute & verify
assertThat([settings htmlReferenceForObject:class1 fromSource:class2], is(@"../Classes/Class1.html"));
assertThat([settings htmlReferenceForObject:class2 fromSource:class1], is(@"../Classes/Class2.html"));
- assertThat([settings htmlReferenceForObject:category1 fromSource:category2], is(@"../Categories/Class(Category1).html"));
- assertThat([settings htmlReferenceForObject:category2 fromSource:category1], is(@"../Categories/Class(Category2).html"));
+ assertThat([settings htmlReferenceForObject:category1 fromSource:category2], is(@"../Categories/Class+Category1.html"));
+ assertThat([settings htmlReferenceForObject:category2 fromSource:category1], is(@"../Categories/Class+Category2.html"));
assertThat([settings htmlReferenceForObject:protocol1 fromSource:protocol2], is(@"../Protocols/Protocol1.html"));
assertThat([settings htmlReferenceForObject:protocol2 fromSource:protocol1], is(@"../Protocols/Protocol2.html"));
assertThat([settings htmlReferenceForObject:document1 fromSource:document2], is(@"../docs/include/document1.html"));
@@ -294,10 +294,10 @@ - (void)testHtmlReferenceForObjectFromSource_shouldReturnProperValueForTopLevelO
assertThat([settings htmlReferenceForObject:class fromSource:protocol], is(@"../Classes/Class.html"));
assertThat([settings htmlReferenceForObject:class fromSource:document1], is(@"../Classes/Class.html"));
assertThat([settings htmlReferenceForObject:class fromSource:document2], is(@"../../Classes/Class.html"));
- assertThat([settings htmlReferenceForObject:category fromSource:class], is(@"../Categories/Class(Category).html"));
- assertThat([settings htmlReferenceForObject:category fromSource:protocol], is(@"../Categories/Class(Category).html"));
- assertThat([settings htmlReferenceForObject:category fromSource:document1], is(@"../Categories/Class(Category).html"));
- assertThat([settings htmlReferenceForObject:category fromSource:document2], is(@"../../Categories/Class(Category).html"));
+ assertThat([settings htmlReferenceForObject:category fromSource:class], is(@"../Categories/Class+Category.html"));
+ assertThat([settings htmlReferenceForObject:category fromSource:protocol], is(@"../Categories/Class+Category.html"));
+ assertThat([settings htmlReferenceForObject:category fromSource:document1], is(@"../Categories/Class+Category.html"));
+ assertThat([settings htmlReferenceForObject:category fromSource:document2], is(@"../../Categories/Class+Category.html"));
assertThat([settings htmlReferenceForObject:protocol fromSource:class], is(@"../Protocols/Protocol.html"));
assertThat([settings htmlReferenceForObject:protocol fromSource:category], is(@"../Protocols/Protocol.html"));
assertThat([settings htmlReferenceForObject:protocol fromSource:document1], is(@"../Protocols/Protocol.html"));
@@ -77,7 +77,7 @@ - (void)testProcessCommentWithContextStore_markdown_shouldKeepInlineTopLevelObje
[processor processComment:comment4 withContext:nil store:store];
// verify
[self assertComment:comment1 matchesLongDescMarkdown:@"[Class](Classes/Class.html)", nil];
- [self assertComment:comment2 matchesLongDescMarkdown:@"[Class(Category)](Categories/Class(Category).html)", nil];
+ [self assertComment:comment2 matchesLongDescMarkdown:@"[Class(Category)](Categories/Class+Category.html)", nil];
[self assertComment:comment3 matchesLongDescMarkdown:@"[Protocol](Protocols/Protocol.html)", nil];
[self assertComment:comment4 matchesLongDescMarkdown:@"[Document](docs/Document.html)", nil];
}
@@ -136,7 +136,7 @@ - (void)testProcessCommentWithContextStore_markdown_shouldProperlyFormatInlineLi
[processor processComment:comment6 withContext:nil store:store];
// verify
[self assertComment:comment1 matchesLongDescMarkdown:@"[`Class`](Classes/Class.html)", nil];
- [self assertComment:comment2 matchesLongDescMarkdown:@"[`Class(Category)`](Categories/Class(Category).html)", nil];
+ [self assertComment:comment2 matchesLongDescMarkdown:@"[`Class(Category)`](Categories/Class+Category.html)", nil];
[self assertComment:comment3 matchesLongDescMarkdown:@"*[Protocol](Protocols/Protocol.html)*", nil];
[self assertComment:comment4 matchesLongDescMarkdown:@"_[Document](docs/Document.html)_", nil];
[self assertComment:comment5 matchesLongDescMarkdown:@"**[Protocol](Protocols/Protocol.html)**", nil];
@@ -198,7 +198,7 @@ - (void)testProcessCommentWithContextStore_markdown_shouldKeepRelatedItemsTopLev
[processor processComment:comment4 withContext:nil store:store];
// verify
[self assertComponents:comment1.relatedItems matchMarkdown:@"[Class](Classes/Class.html)", nil];
- [self assertComponents:comment2.relatedItems matchMarkdown:@"[Class(Category)](Categories/Class(Category).html)", nil];
+ [self assertComponents:comment2.relatedItems matchMarkdown:@"[Class(Category)](Categories/Class+Category.html)", nil];
[self assertComponents:comment3.relatedItems matchMarkdown:@"[Protocol](Protocols/Protocol.html)", nil];
[self assertComponents:comment4.relatedItems matchMarkdown:@"[Document](docs/Document.html)", nil];
}
@@ -147,8 +147,8 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertCategory {
NSString *result3 = [processor stringByConvertingCrossReferencesInString:@"Class(Unknown)" withFlags:0];
NSString *result4 = [processor stringByConvertingCrossReferencesInString:@"<Class(Unknown)>" withFlags:0];
// verify
- assertThat(result1, is(@"[Class(Category)](Categories/Class(Category).html)"));
- assertThat(result2, is(@"[Class(Category)](Categories/Class(Category).html)"));
+ assertThat(result1, is(@"[Class(Category)](Categories/Class+Category.html)"));
+ assertThat(result2, is(@"[Class(Category)](Categories/Class+Category.html)"));
assertThat(result3, is(@"Class(Unknown)"));
assertThat(result4, is(@"<Class(Unknown)>"));
}
@@ -347,10 +347,10 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertCategoryRemot
NSString *result5 = [processor stringByConvertingCrossReferencesInString:@"[Class(Unknown) method:]" withFlags:0];
NSString *result6 = [processor stringByConvertingCrossReferencesInString:@"[Unknown(Category) method:]" withFlags:0];
// verify
- assertThat(result1, is(@"[[Class(Category) method:]](../Categories/Class(Category).html#//api/name/method:)"));
- assertThat(result2, is(@"[[Class(Category) method:]](../Categories/Class(Category).html#//api/name/method:)"));
- assertThat(result3, is(@"[[Class(Category) method:]](../Categories/Class(Category).html#//api/name/method:)"));
- assertThat(result4, is(@"[[Class(Category) method:]](../Categories/Class(Category).html#//api/name/method:)"));
+ assertThat(result1, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//api/name/method:)"));
+ assertThat(result2, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//api/name/method:)"));
+ assertThat(result3, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//api/name/method:)"));
+ assertThat(result4, is(@"[[Class(Category) method:]](../Categories/Class+Category.html#//api/name/method:)"));
assertThat(result5, is(@"[Class(Unknown) method:]"));
assertThat(result6, is(@"[Unknown(Category) method:]"));
}
@@ -517,8 +517,8 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertCategoryAndCl
NSString *result1 = [processor stringByConvertingCrossReferencesInString:@"Class(Category) Class" withFlags:0];
NSString *result2 = [processor stringByConvertingCrossReferencesInString:@"Class Class(Category)" withFlags:0];
// verify
- assertThat(result1, is(@"[Class(Category)](Categories/Class(Category).html) [Class](Classes/Class.html)"));
- assertThat(result2, is(@"[Class](Classes/Class.html) [Class(Category)](Categories/Class(Category).html)"));
+ assertThat(result1, is(@"[Class(Category)](Categories/Class+Category.html) [Class](Classes/Class.html)"));
+ assertThat(result2, is(@"[Class](Classes/Class.html) [Class(Category)](Categories/Class+Category.html)"));
}
- (void)testStringByConvertingCrossReferencesInString_shouldConvertCategoryAndProtocol {
@@ -531,8 +531,8 @@ - (void)testStringByConvertingCrossReferencesInString_shouldConvertCategoryAndPr
NSString *result1 = [processor stringByConvertingCrossReferencesInString:@"Protocol(Category) Protocol" withFlags:0];
NSString *result2 = [processor stringByConvertingCrossReferencesInString:@"Protocol Protocol(Category)" withFlags:0];
// verify
- assertThat(result1, is(@"[Protocol(Category)](Categories/Protocol(Category).html) [Protocol](Protocols/Protocol.html)"));
- assertThat(result2, is(@"[Protocol](Protocols/Protocol.html) [Protocol(Category)](Categories/Protocol(Category).html)"));
+ assertThat(result1, is(@"[Protocol(Category)](Categories/Protocol+Category.html) [Protocol](Protocols/Protocol.html)"));
+ assertThat(result2, is(@"[Protocol](Protocols/Protocol.html) [Protocol(Category)](Categories/Protocol+Category.html)"));
}
#pragma mark Manual links detection testing
@@ -584,7 +584,7 @@ - (void)testStringByConvertingCrossReferencesInString_shouldKeepManualObjectLink
NSString *result4 = [processor stringByConvertingCrossReferencesInString:@"[text](document)" withFlags:0];
// verify
assertThat(result1, is(@"[text](Classes/Class.html)"));
- assertThat(result2, is(@"[text](Categories/Class(Category).html)"));
+ assertThat(result2, is(@"[text](Categories/Class+Category.html)"));
assertThat(result3, is(@"[text](Protocols/Protocol.html)"));
assertThat(result4, is(@"[text](docs/document.html)"));
}

0 comments on commit 178a2ce

Please sign in to comment.