From 7887ad6932b02ca149520b1624608504da3494bf Mon Sep 17 00:00:00 2001 From: Marius Ursache Date: Tue, 1 Mar 2016 10:45:24 +1100 Subject: Converted PostgresKit tests to XCTest --- .../PostgresKit.xcodeproj/project.pbxproj | 44 ++++++++++++---------- .../xcshareddata/xcschemes/PostgresKit.xcscheme | 16 +++++++- Frameworks/PostgresKit/Resources/Info.plist | 2 +- Frameworks/PostgresKit/Resources/Tests-Info.plist | 2 +- Frameworks/PostgresKit/Tests/PGDataTypeTests.h | 2 +- Frameworks/PostgresKit/Tests/PGDataTypeTests.m | 12 +++--- .../Tests/PGPostgresIntegrationTestCase.h | 4 +- .../Tests/PGPostgresIntegrationTestCase.m | 2 +- .../PostgresKit/Tests/PGPostgresResultTests.h | 2 +- .../PostgresKit/Tests/PGPostgresResultTests.m | 4 +- 10 files changed, 53 insertions(+), 37 deletions(-) (limited to 'Frameworks/PostgresKit') diff --git a/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj b/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj index 479474da..bf8e5545 100644 --- a/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj +++ b/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj @@ -81,7 +81,7 @@ 1724CA3B15F9EE7300AB2291 /* libpqtypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libpqtypes.h; sourceTree = ""; }; 1724CC9015FB4CC200AB2291 /* PGPostgresTimeTZ.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PGPostgresTimeTZ.h; sourceTree = ""; }; 1724CC9115FB4CC200AB2291 /* PGPostgresTimeTZ.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGPostgresTimeTZ.m; sourceTree = ""; }; - 1724CD0415FB68E800AB2291 /* Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1724CD0415FB68E800AB2291 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 1724CD0515FB68E800AB2291 /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Tests-Info.plist"; path = "Resources/Tests-Info.plist"; sourceTree = ""; }; 1724CD5715FB8A3300AB2291 /* PGPostgresTimeInterval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PGPostgresTimeInterval.h; sourceTree = ""; }; 1724CD5815FB8A3300AB2291 /* PGPostgresTimeInterval.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGPostgresTimeInterval.m; sourceTree = ""; }; @@ -167,7 +167,7 @@ isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* PostgresKit.framework */, - 1724CD0415FB68E800AB2291 /* Tests.octest */, + 1724CD0415FB68E800AB2291 /* Tests.xctest */, ); name = Products; sourceTree = ""; @@ -460,8 +460,8 @@ ); name = Tests; productName = Tests; - productReference = 1724CD0415FB68E800AB2291 /* Tests.octest */; - productType = "com.apple.product-type.bundle"; + productReference = 1724CD0415FB68E800AB2291 /* Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; }; 8DC2EF4F0486A6940098B216 /* PostgresKit */ = { isa = PBXNativeTarget; @@ -487,7 +487,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0500; + LastUpgradeCheck = 0720; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "PostgresKit" */; compatibilityVersion = "Xcode 3.2"; @@ -565,7 +565,7 @@ CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; @@ -576,12 +576,9 @@ OTHER_LDFLAGS = ( "-framework", Cocoa, - "-framework", - SenTestingKit, ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.postgreskit.tests; PRODUCT_NAME = Tests; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; }; name = Debug; }; @@ -592,7 +589,7 @@ CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -601,12 +598,9 @@ OTHER_LDFLAGS = ( "-framework", Cocoa, - "-framework", - SenTestingKit, ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.postgreskit.tests; PRODUCT_NAME = Tests; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; ZERO_LINK = NO; }; name = Release; @@ -617,7 +611,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -626,12 +620,9 @@ OTHER_LDFLAGS = ( "-framework", Cocoa, - "-framework", - SenTestingKit, ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.postgreskit.tests; PRODUCT_NAME = Tests; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; }; name = Distribution; }; @@ -645,8 +636,11 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Source/PostgresKit-Prefix.pch"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; @@ -704,6 +698,7 @@ "$(inherited)", "\"$(SRCROOT)/Libs\"/**", ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.postgreskit; PRODUCT_NAME = PostgresKit; WARNING_CFLAGS = "-Wmost"; WRAPPER_EXTENSION = framework; @@ -756,6 +751,7 @@ "$(inherited)", "\"$(SRCROOT)/Libs\"/**", ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.postgreskit; PRODUCT_NAME = PostgresKit; WARNING_CFLAGS = "-Wmost"; WRAPPER_EXTENSION = framework; @@ -803,6 +799,7 @@ "$(inherited)", "\"$(SRCROOT)/Libs\"/**", ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.postgreskit; PRODUCT_NAME = PostgresKit; WARNING_CFLAGS = "-Wmost"; WRAPPER_EXTENSION = framework; @@ -819,8 +816,12 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Source/PostgresKit-Prefix.pch"; @@ -849,8 +850,11 @@ CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Source/PostgresKit-Prefix.pch"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; diff --git a/Frameworks/PostgresKit/PostgresKit.xcodeproj/xcshareddata/xcschemes/PostgresKit.xcscheme b/Frameworks/PostgresKit/PostgresKit.xcodeproj/xcshareddata/xcschemes/PostgresKit.xcscheme index ca74a70b..04dd4bea 100644 --- a/Frameworks/PostgresKit/PostgresKit.xcodeproj/xcshareddata/xcschemes/PostgresKit.xcscheme +++ b/Frameworks/PostgresKit/PostgresKit.xcodeproj/xcshareddata/xcschemes/PostgresKit.xcscheme @@ -1,6 +1,6 @@ + + + + + + diff --git a/Frameworks/PostgresKit/Resources/Info.plist b/Frameworks/PostgresKit/Resources/Info.plist index b961331f..0da2c36b 100644 --- a/Frameworks/PostgresKit/Resources/Info.plist +++ b/Frameworks/PostgresKit/Resources/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable PostgresKit CFBundleIdentifier - com.sequelpro.postgreskit + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/Frameworks/PostgresKit/Resources/Tests-Info.plist b/Frameworks/PostgresKit/Resources/Tests-Info.plist index b88d8638..ddbc4bf7 100644 --- a/Frameworks/PostgresKit/Resources/Tests-Info.plist +++ b/Frameworks/PostgresKit/Resources/Tests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable Tests CFBundleIdentifier - com.sequelpro.postgreskit.tests + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/Frameworks/PostgresKit/Tests/PGDataTypeTests.h b/Frameworks/PostgresKit/Tests/PGDataTypeTests.h index 8f6b54ad..7322823f 100644 --- a/Frameworks/PostgresKit/Tests/PGDataTypeTests.h +++ b/Frameworks/PostgresKit/Tests/PGDataTypeTests.h @@ -27,7 +27,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #import -#import +#import #import "PGPostgresIntegrationTestCase.h" diff --git a/Frameworks/PostgresKit/Tests/PGDataTypeTests.m b/Frameworks/PostgresKit/Tests/PGDataTypeTests.m index a2048ed6..8ffd8b47 100644 --- a/Frameworks/PostgresKit/Tests/PGDataTypeTests.m +++ b/Frameworks/PostgresKit/Tests/PGDataTypeTests.m @@ -33,7 +33,7 @@ + (void)_addTestForField:(NSString *)field withExpectedResult:(id)result connection:(PGPostgresConnection *)connection - toTestSuite:(SenTestSuite *)testSuite; + toTestSuite:(XCTestSuite *)testSuite; @end @@ -48,7 +48,7 @@ + (id)defaultTestSuite { - SenTestSuite *testSuite = [[SenTestSuite alloc] initWithName:[self className]]; + XCTestSuite *testSuite = [[XCTestSuite alloc] initWithName:[self className]]; PGPostgresConnection *connection = [[PGPostgresConnection alloc] init]; @@ -109,12 +109,12 @@ - (void)testResultValueIsNotNil { - STAssertNotNil(_result, nil); + XCTAssertNotNil(_result); } - (void)testResultIsOfCorrectTypeAndValue { - STAssertEqualObjects(_result, _expectedResult, nil); + XCTAssertEqualObjects(_result, _expectedResult); } #pragma mark - @@ -123,11 +123,11 @@ + (void)_addTestForField:(NSString *)field withExpectedResult:(id)result connection:(PGPostgresConnection *)connection - toTestSuite:(SenTestSuite *)testSuite + toTestSuite:(XCTestSuite *)testSuite { for (NSInvocation *invocation in [self testInvocations]) { - SenTestCase *test = [[[self class] alloc] initWithInvocation:invocation connection:connection expectedResult:result field:field]; + XCTestCase *test = [[[self class] alloc] initWithInvocation:invocation connection:connection expectedResult:result field:field]; [testSuite addTest:test]; diff --git a/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.h b/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.h index c6706156..7a654f5f 100644 --- a/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.h +++ b/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.h @@ -27,9 +27,9 @@ // OTHER DEALINGS IN THE SOFTWARE. #import -#import +#import -@interface PGPostgresIntegrationTestCase : SenTestCase +@interface PGPostgresIntegrationTestCase : XCTestCase { PGPostgresConnection *_connection; } diff --git a/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m b/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m index e6c96505..96de8a40 100644 --- a/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m +++ b/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m @@ -67,7 +67,7 @@ static NSUInteger PGTestDatabasePort = 5432; [_connection setPassword:PGTestDatabasePassword]; if (![_connection connect]) { - STFail(@"Request to establish connection to local database failed."); + XCTFail(@"Request to establish connection to local database failed."); exit(1); } diff --git a/Frameworks/PostgresKit/Tests/PGPostgresResultTests.h b/Frameworks/PostgresKit/Tests/PGPostgresResultTests.h index 93c36427..e01aedec 100644 --- a/Frameworks/PostgresKit/Tests/PGPostgresResultTests.h +++ b/Frameworks/PostgresKit/Tests/PGPostgresResultTests.h @@ -27,7 +27,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #import -#import +#import #import "PGPostgresIntegrationTestCase.h" diff --git a/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m b/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m index ef64ea53..8e27b163 100644 --- a/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m +++ b/Frameworks/PostgresKit/Tests/PGPostgresResultTests.m @@ -63,7 +63,7 @@ "}"); // Compare the output after getting rid of newlines and spaces - STAssertTrue([[[[_result description] stringByReplacingOccurrencesOfString:@"\n" withString:@""] stringByReplacingOccurrencesOfString:@" " withString:@""] isEqualToString:@"{" + XCTAssertTrue([[[[_result description] stringByReplacingOccurrencesOfString:@"\n" withString:@""] stringByReplacingOccurrencesOfString:@" " withString:@""] isEqualToString:@"{" "\"bigint_field\" = 123456789;" "\"bool_field\" = 1;" "\"char_field\" = CHAR;" @@ -77,7 +77,7 @@ "\"timestamptz_field\" = \"8 Apr 1987 03:02:02 GMT+01:00\";" "\"timetz_field\" = \"02:02:02 GMT+10:00\";" "\"varchar_field\" = VARCHAR;" - "}"], nil); + "}"]); } #pragma mark - -- cgit v1.2.3