Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed GBApplicationSettingsProvider NSCopying.

This was added while implementing global settings as one possible solution, but the actual used solution was different, so this only added dead code with difficult to maintain unit test.
  • Loading branch information...
commit a422865f8664d2fc8cc7367ead7ae11dfcc74f93 1 parent 8a00798
@tomaz authored
View
2  Application/GBApplicationSettingsProvider.h
@@ -15,7 +15,7 @@
This object implements `GBApplicationStringsProviding` interface and is used by `GBAppledocApplication` to prepare application-wide settings including factory defaults, global and session values. The main purpose of the class is to simplify `GBAppledocApplication` class by decoupling it from the actual settings providing implementation.
*/
-@interface GBApplicationSettingsProvider : NSObject <NSCopying>
+@interface GBApplicationSettingsProvider : NSObject
///---------------------------------------------------------------------------------------
/// @name Initialization & disposal
View
21 Application/GBApplicationSettingsProvider.m
@@ -87,27 +87,6 @@ - (id)init {
return self;
}
-- (id)copyWithZone:(NSZone *)zone {
- // This uses reflection to get the list of all properties and then KVC to copy the values from this object to the copy, skipping helper classes to keep
- NSSet *ignored = [[self class] nonCopyableProperties];
- id result = [[[[self class] alloc] init] autorelease];
- unsigned int count;
- objc_property_t *properties = class_copyPropertyList([self class], &count);
- for (unsigned int i=0; i<count; i++) {
- objc_property_t property = properties[i];
- const char *name = property_getName(property);
- if (!name) continue;
-
- NSString *key = [NSString stringWithCString:name encoding:NSASCIIStringEncoding];
- if ([ignored containsObject:key]) continue;
-
- id value = [self valueForKey:key];
- [result setValue:value forKey:key];
- }
- free(properties);
- return result;
-}
-
#pragma mark Helper methods
- (void)replaceAllOccurencesOfPlaceholderStringsInSettingsValues {
View
80 Testing/GBApplicationSettingsProviderTesting.m
@@ -18,86 +18,6 @@ - (NSDateFormatter *)yearToDayFormatterFromSettings:(GBApplicationSettingsProvid
@implementation GBApplicationSettingsProviderTesting
-#pragma mark Copying testing
-
-- (void)testCopyWithZone_shouldCopyAllPropertyValues {
- // setup
- GBApplicationSettingsProvider *original = [GBApplicationSettingsProvider provider];
- original.outputPath = @"A1";
- original.templatesPath = @"A2";
- original.docsetInstallPath = @"A3";
- original.ignoredPaths = [NSMutableSet setWithObjects:@"I1", @"I2", nil];
- original.projectName = @"P1";
- original.projectCompany = @"P2";
- original.projectVersion = @"P3";
- original.companyIdentifier = @"P4";
- original.createHTML = NO;
- original.createDocSet = NO;
- original.installDocSet = NO;
- original.keepUndocumentedObjects = NO;
- original.keepUndocumentedMembers = NO;
- original.findUndocumentedMembersDocumentation = NO;
- original.mergeCategoriesToClasses = NO;
- original.keepMergedCategoriesSections = NO;
- original.prefixMergedCategoriesSectionsWithCategoryName = NO;
- original.warnOnMissingOutputPathArgument = NO;
- original.warnOnMissingCompanyIdentifier = NO;
- original.warnOnUndocumentedObject = NO;
- original.warnOnUndocumentedMember = NO;
- original.warnOnInvalidCrossReference = NO;
- original.docsetBundleIdentifier = @"D1";
- original.docsetBundleName = @"D2";
- original.docsetCertificateIssuer = @"D3";
- original.docsetCertificateSigner = @"D4";
- original.docsetDescription = @"D5";
- original.docsetFallbackURL = @"D6";
- original.docsetFeedName = @"D7";
- original.docsetFeedURL = @"D8";
- original.docsetMinimumXcodeVersion = @"D9";
- original.docsetPlatformFamily = @"D10";
- original.docsetPublisherIdentifier = @"D11";
- original.docsetPublisherName = @"D12";
- original.docsetCopyrightMessage = @"D13";
- // execute
- GBApplicationSettingsProvider *copy = [original copyWithZone:nil];
- // verify
- assertThat(copy.outputPath, is(original.outputPath));
- assertThat(copy.templatesPath, is(original.templatesPath));
- assertThat(copy.docsetInstallPath, is(original.docsetInstallPath));
- assertThat(copy.ignoredPaths, is(original.ignoredPaths));
- assertThat(copy.projectName, is(original.projectName));
- assertThat(copy.projectCompany, is(original.projectCompany));
- assertThat(copy.projectVersion, is(original.projectVersion));
- assertThat(copy.companyIdentifier, is(original.companyIdentifier));
- assertThatBool(copy.createHTML, equalToBool(original.createHTML));
- assertThatBool(copy.createDocSet, equalToBool(original.createDocSet));
- assertThatBool(copy.installDocSet, equalToBool(original.installDocSet));
- assertThatBool(copy.keepUndocumentedObjects, equalToBool(original.keepUndocumentedObjects));
- assertThatBool(copy.keepUndocumentedMembers, equalToBool(original.keepUndocumentedMembers));
- assertThatBool(copy.findUndocumentedMembersDocumentation, equalToBool(original.findUndocumentedMembersDocumentation));
- assertThatBool(copy.mergeCategoriesToClasses, equalToBool(original.mergeCategoriesToClasses));
- assertThatBool(copy.keepMergedCategoriesSections, equalToBool(original.keepMergedCategoriesSections));
- assertThatBool(copy.prefixMergedCategoriesSectionsWithCategoryName, equalToBool(original.prefixMergedCategoriesSectionsWithCategoryName));
- assertThatBool(copy.warnOnMissingOutputPathArgument, equalToBool(original.warnOnMissingOutputPathArgument));
- assertThatBool(copy.warnOnMissingCompanyIdentifier, equalToBool(original.warnOnMissingCompanyIdentifier));
- assertThatBool(copy.warnOnUndocumentedObject, equalToBool(original.warnOnUndocumentedObject));
- assertThatBool(copy.warnOnUndocumentedMember, equalToBool(original.warnOnUndocumentedMember));
- assertThatBool(copy.warnOnInvalidCrossReference, equalToBool(original.warnOnInvalidCrossReference));
- assertThat(copy.docsetBundleIdentifier, is(original.docsetBundleIdentifier));
- assertThat(copy.docsetBundleName, is(original.docsetBundleName));
- assertThat(copy.docsetCertificateIssuer, is(original.docsetCertificateIssuer));
- assertThat(copy.docsetCertificateSigner, is(original.docsetCertificateSigner));
- assertThat(copy.docsetDescription, is(original.docsetDescription));
- assertThat(copy.docsetFallbackURL, is(original.docsetFallbackURL));
- assertThat(copy.docsetFeedName, is(original.docsetFeedName));
- assertThat(copy.docsetFeedURL, is(original.docsetFeedURL));
- assertThat(copy.docsetMinimumXcodeVersion, is(original.docsetMinimumXcodeVersion));
- assertThat(copy.docsetPlatformFamily, is(original.docsetPlatformFamily));
- assertThat(copy.docsetPublisherIdentifier, is(original.docsetPublisherIdentifier));
- assertThat(copy.docsetPublisherName, is(original.docsetPublisherName));
- assertThat(copy.docsetCopyrightMessage, is(original.docsetCopyrightMessage));
-}
-
#pragma mark Placeholders replacing
- (void)testPlaceholderReplacements_shouldReplacePlaceholderStringsInAllSupportedValues {
Please sign in to comment.
Something went wrong with that request. Please try again.