Skip to content
Browse files

docsetFeedFormats is not a string

Remove support for templates in `--docset-feed-formats` option, which is not necessary and does not work. Write a proper test case that does not crash. Fix compiler warnings on conversion of enum to id.
  • Loading branch information...
1 parent bd4df3f commit 7a31013492f61eb078e10852add0d46d2220c7cc @paulmelnikow paulmelnikow committed Jun 15, 2013
View
2 Application/GBAppledocApplication.m
@@ -1031,7 +1031,7 @@ - (void)printHelp {
PRINT_USAGE(@" ", kGBArgDocSetCopyrightMessage, @"<string>", @"[*] DocSet copyright message");
PRINT_USAGE(@" ", kGBArgDocSetFeedName, @"<string>", @"[*] DocSet feed name");
PRINT_USAGE(@" ", kGBArgDocSetFeedURL, @"<string>", @"[*] DocSet feed URL");
- PRINT_USAGE(@" ", kGBArgDocSetFeedFormats, @"<values>", @"[*] DocSet feed formats. Separated by a comma [atom,xml]");
+ PRINT_USAGE(@" ", kGBArgDocSetFeedFormats, @"<values>", @"DocSet feed formats. Separated by a comma [atom,xml]");
PRINT_USAGE(@" ", kGBArgDocSetPackageURL, @"<string>", @"[*] DocSet package (.xar) URL");
PRINT_USAGE(@" ", kGBArgDocSetFallbackURL, @"<string>", @"[*] DocSet fallback URL");
PRINT_USAGE(@" ", kGBArgDocSetPublisherIdentifier, @"<string>", @"[*] DocSet publisher identifier");
View
4 Application/GBApplicationSettingsProvider.h
@@ -24,8 +24,8 @@ NSString *NSStringFromGBHTMLAnchorFormat(GBHTMLAnchorFormat format);
typedef enum
{
- GBPublishedFeedFormatAtom = 1,
- GBPublishedFeedFormatXML = 2
+ GBPublishedFeedFormatAtom = 1 << 1,
+ GBPublishedFeedFormatXML = 1 << 2
} GBPublishedFeedFormats;
GBPublishedFeedFormats GBPublishedFeedFormatsFromNSString(NSString *formatString);
View
4 Testing/GBApplicationSettingsProviderTesting.m
@@ -36,7 +36,6 @@ - (void)testPlaceholderReplacements_shouldReplacePlaceholderStringsInAllSupporte
settings.docsetFallbackURL = template;
settings.docsetFeedName = template;
settings.docsetFeedURL = template;
- settings.docsetFeedFormats = template;
settings.docsetPackageURL = template;
settings.docsetMinimumXcodeVersion = template;
settings.docsetPlatformFamily = template;
@@ -63,7 +62,6 @@ - (void)testPlaceholderReplacements_shouldReplacePlaceholderStringsInAllSupporte
assertThat(settings.docsetFallbackURL, is(expected));
assertThat(settings.docsetFeedName, is(expected));
assertThat(settings.docsetFeedURL, is(expected));
- assertThat(settings.docsetFeedFormats, is(expected));
assertThat(settings.docsetPackageURL, is(expected));
assertThat(settings.docsetMinimumXcodeVersion, is(expected));
assertThat(settings.docsetPlatformFamily, is(expected));
@@ -96,7 +94,6 @@ - (void)testPlaceholderReplacements_shouldReplaceDocSetFilenames {
settings.docsetFallbackURL = template;
settings.docsetFeedName = template;
settings.docsetFeedURL = template;
- settings.docsetFeedFormats = template;
settings.docsetPackageURL = template;
settings.docsetMinimumXcodeVersion = template;
settings.docsetPlatformFamily = template;
@@ -115,7 +112,6 @@ - (void)testPlaceholderReplacements_shouldReplaceDocSetFilenames {
assertThat(settings.docsetFallbackURL, is(expected));
assertThat(settings.docsetFeedName, is(expected));
assertThat(settings.docsetFeedURL, is(expected));
- assertThat(settings.docsetFeedFormats, is(expected));
assertThat(settings.docsetPackageURL, is(expected));
assertThat(settings.docsetMinimumXcodeVersion, is(expected));
assertThat(settings.docsetPlatformFamily, is(expected));
View
13 Testing/GBApplicationTesting.m
@@ -464,11 +464,18 @@ - (void)testDocSetFeedURL_shouldAssignValueToSettings {
}
- (void)testDocSetFeedFormat_shouldAssignValueToSettings {
-
// setup & execute
- GBApplicationSettingsProvider *settings = [self settingsByRunningWithArgs:@"--docset-feed-formats", @"value", nil];
+ GBApplicationSettingsProvider *settings1 = [self settingsByRunningWithArgs:@"--docset-feed-formats", @"value", nil];
+ GBApplicationSettingsProvider *settings2 = [self settingsByRunningWithArgs:@"--docset-feed-formats", @"atom", nil];
+ GBApplicationSettingsProvider *settings3 = [self settingsByRunningWithArgs:@"--docset-feed-formats", @"xml", nil];
+ GBApplicationSettingsProvider *settings4 = [self settingsByRunningWithArgs:@"--docset-feed-formats", @"atom,xml", nil];
+ GBApplicationSettingsProvider *settings5 = [self settingsByRunningWithArgs:@"--docset-feed-formats", @"xml,atom", nil];
// verify
- assertThat(settings.docsetFeedFormats, is(@"value"));
+ assertThatInteger(settings1.docsetFeedFormats, equalToInteger(0));
+ assertThatInteger(settings2.docsetFeedFormats, equalToInteger(GBPublishedFeedFormatAtom));
+ assertThatInteger(settings3.docsetFeedFormats, equalToInteger(GBPublishedFeedFormatXML));
+ assertThatInteger(settings4.docsetFeedFormats, equalToInteger(GBPublishedFeedFormatAtom | GBPublishedFeedFormatXML));
+ assertThatInteger(settings5.docsetFeedFormats, equalToInteger(GBPublishedFeedFormatAtom | GBPublishedFeedFormatXML));
}
- (void)testDocSetPackageURL_shouldAssignValueToSettings {

0 comments on commit 7a31013

Please sign in to comment.
Something went wrong with that request. Please try again.