diff options
43 files changed, 425 insertions, 254 deletions
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 = "<group>"; }; 1724CC9015FB4CC200AB2291 /* PGPostgresTimeTZ.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PGPostgresTimeTZ.h; sourceTree = "<group>"; }; 1724CC9115FB4CC200AB2291 /* PGPostgresTimeTZ.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGPostgresTimeTZ.m; sourceTree = "<group>"; }; - 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 = "<group>"; }; 1724CD5715FB8A3300AB2291 /* PGPostgresTimeInterval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PGPostgresTimeInterval.h; sourceTree = "<group>"; }; 1724CD5815FB8A3300AB2291 /* PGPostgresTimeInterval.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGPostgresTimeInterval.m; sourceTree = "<group>"; }; @@ -167,7 +167,7 @@ isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* PostgresKit.framework */, - 1724CD0415FB68E800AB2291 /* Tests.octest */, + 1724CD0415FB68E800AB2291 /* Tests.xctest */, ); name = Products; sourceTree = "<group>"; @@ -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 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0500" + LastUpgradeVersion = "0720" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -33,12 +33,14 @@ <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "1724CD0315FB68E800AB2291" - BuildableName = "Tests.octest" + BuildableName = "Tests.xctest" BlueprintName = "Tests" ReferencedContainer = "container:PostgresKit.xcodeproj"> </BuildableReference> </TestableReference> </Testables> + <AdditionalOptions> + </AdditionalOptions> </TestAction> <LaunchAction selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" @@ -48,7 +50,17 @@ buildConfiguration = "Debug" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" + debugServiceExtension = "internal" allowLocationSimulation = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DC2EF4F0486A6940098B216" + BuildableName = "PostgresKit.framework" + BlueprintName = "PostgresKit" + ReferencedContainer = "container:PostgresKit.xcodeproj"> + </BuildableReference> + </MacroExpansion> <AdditionalOptions> </AdditionalOptions> </LaunchAction> 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 @@ <key>CFBundleExecutable</key> <string>PostgresKit</string> <key>CFBundleIdentifier</key> - <string>com.sequelpro.postgreskit</string> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> 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 @@ <key>CFBundleExecutable</key> <string>Tests</string> <key>CFBundleIdentifier</key> - <string>com.sequelpro.postgreskit.tests</string> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> 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 <PostgresKit/PostgresKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> #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 <PostgresKit/PostgresKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> -@interface PGPostgresIntegrationTestCase : SenTestCase +@interface PGPostgresIntegrationTestCase : XCTestCase { PGPostgresConnection *_connection; } diff --git a/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m b/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m index e6c96505..231e1bfa 100644 --- a/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m +++ b/Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m @@ -35,6 +35,8 @@ static NSString *PGTestDatabasePassword = @"pgkit"; static NSUInteger PGTestDatabasePort = 5432; +static double PGTestConnectionTimeout = 0.2; + @interface PGPostgresIntegrationTestCase () - (void)_establishConnection; @@ -67,13 +69,25 @@ 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); } + NSDate *startDate = [NSDate date]; + do { sleep(0.1); + + if([[NSDate date] timeIntervalSinceDate:startDate] > PGTestConnectionTimeout) { + XCTFail(@"Failed to connect to database after %f seconds. Host:%@ Database:%@ User:%@ Password:%@", + PGTestConnectionTimeout, + PGTestDatabaseHost, + PGTestDatabaseName, + PGTestDatabaseUser, + PGTestDatabasePassword); + exit(1); + } } while (![_connection isConnected]); } 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 <PostgresKit/PostgresKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> #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 - diff --git a/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj b/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj index 62059d07..52ef1774 100644 --- a/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj +++ b/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj @@ -87,7 +87,7 @@ 17E5951E14F301DF0054EE08 /* QueryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QueryKit.h; sourceTree = "<group>"; }; 17E595F114F3058F0054EE08 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 17E5969814F307B70054EE08 /* QKSelectQueryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKSelectQueryTests.m; sourceTree = "<group>"; }; - 17E5969E14F307CE0054EE08 /* Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + 17E5969E14F307CE0054EE08 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 17E5969F14F307CE0054EE08 /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Tests-Info.plist"; path = "Resources/Tests-Info.plist"; sourceTree = "<group>"; }; 17F48BA615B27F6400C6455B /* QKQueryOrderBy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QKQueryOrderBy.h; sourceTree = "<group>"; }; 17F48BA715B27F6400C6455B /* QKQueryOrderBy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QKQueryOrderBy.m; sourceTree = "<group>"; }; @@ -123,7 +123,7 @@ isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* QueryKit.framework */, - 17E5969E14F307CE0054EE08 /* Tests.octest */, + 17E5969E14F307CE0054EE08 /* Tests.xctest */, ); name = Products; sourceTree = "<group>"; @@ -329,8 +329,8 @@ ); name = Tests; productName = Tests; - productReference = 17E5969E14F307CE0054EE08 /* Tests.octest */; - productType = "com.apple.product-type.bundle"; + productReference = 17E5969E14F307CE0054EE08 /* Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; }; 8DC2EF4F0486A6940098B216 /* QueryKit */ = { isa = PBXNativeTarget; @@ -357,7 +357,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0720; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "QueryKit" */; compatibilityVersion = "Xcode 3.2"; @@ -436,7 +436,7 @@ 17E5952D14F302740054EE08 /* Distribution */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CLANG_LINK_OBJC_RUNTIME = NO; CLANG_STATIC_ANALYZER_MODE = deep; CLANG_WARN_BOOL_CONVERSION = YES; @@ -444,8 +444,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/QueryKit-Prefix.pch"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; @@ -498,6 +501,7 @@ GCC_WARN_UNUSED_VALUE = YES; INFOPLIST_FILE = Resources/Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.querykit; PRODUCT_NAME = QueryKit; SKIP_INSTALL = YES; WARNING_CFLAGS = "-Wmost"; @@ -511,7 +515,7 @@ ALWAYS_SEARCH_USER_PATHS = 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_OBJC_EXCEPTIONS = YES; GCC_MODEL_TUNING = G5; @@ -523,12 +527,9 @@ OTHER_LDFLAGS = ( "-framework", Cocoa, - "-framework", - SenTestingKit, ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.querykit.tests; PRODUCT_NAME = Tests; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; }; name = Debug; }; @@ -539,7 +540,7 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -549,12 +550,9 @@ OTHER_LDFLAGS = ( "-framework", Cocoa, - "-framework", - SenTestingKit, ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.querykit.tests; PRODUCT_NAME = Tests; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; ZERO_LINK = NO; }; name = Release; @@ -564,7 +562,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -574,12 +572,9 @@ OTHER_LDFLAGS = ( "-framework", Cocoa, - "-framework", - SenTestingKit, ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.querykit.tests; PRODUCT_NAME = Tests; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; }; name = Distribution; }; @@ -623,6 +618,7 @@ GENERATE_PKGINFO_FILE = YES; INFOPLIST_FILE = Resources/Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.querykit; PRODUCT_NAME = QueryKit; SKIP_INSTALL = YES; WARNING_CFLAGS = "-Wmost"; @@ -666,6 +662,7 @@ GCC_WARN_UNUSED_VALUE = YES; INFOPLIST_FILE = Resources/Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.querykit; PRODUCT_NAME = QueryKit; SKIP_INSTALL = YES; WARNING_CFLAGS = "-Wmost"; @@ -676,7 +673,7 @@ 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CLANG_LINK_OBJC_RUNTIME = NO; CLANG_STATIC_ANALYZER_MODE = deep; CLANG_WARN_BOOL_CONVERSION = YES; @@ -684,8 +681,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/QueryKit-Prefix.pch"; @@ -707,7 +708,7 @@ 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CLANG_LINK_OBJC_RUNTIME = NO; CLANG_STATIC_ANALYZER_MODE = deep; CLANG_WARN_BOOL_CONVERSION = YES; @@ -715,8 +716,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/QueryKit-Prefix.pch"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; diff --git a/Frameworks/QueryKit/QueryKit.xcodeproj/xcshareddata/xcschemes/QueryKit.xcscheme b/Frameworks/QueryKit/QueryKit.xcodeproj/xcshareddata/xcschemes/QueryKit.xcscheme index fcff0831..b5c97922 100644 --- a/Frameworks/QueryKit/QueryKit.xcodeproj/xcshareddata/xcschemes/QueryKit.xcscheme +++ b/Frameworks/QueryKit/QueryKit.xcodeproj/xcshareddata/xcschemes/QueryKit.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0510" + LastUpgradeVersion = "0720" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -33,12 +33,14 @@ <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "17E5969D14F307CE0054EE08" - BuildableName = "Tests.octest" + BuildableName = "Tests.xctest" BlueprintName = "Tests" ReferencedContainer = "container:QueryKit.xcodeproj"> </BuildableReference> </TestableReference> </Testables> + <AdditionalOptions> + </AdditionalOptions> </TestAction> <LaunchAction selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" @@ -48,7 +50,17 @@ buildConfiguration = "Debug" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" + debugServiceExtension = "internal" allowLocationSimulation = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DC2EF4F0486A6940098B216" + BuildableName = "QueryKit.framework" + BlueprintName = "QueryKit" + ReferencedContainer = "container:QueryKit.xcodeproj"> + </BuildableReference> + </MacroExpansion> <AdditionalOptions> </AdditionalOptions> </LaunchAction> diff --git a/Frameworks/QueryKit/Resources/Info.plist b/Frameworks/QueryKit/Resources/Info.plist index 6c5911aa..5c5cdce8 100644 --- a/Frameworks/QueryKit/Resources/Info.plist +++ b/Frameworks/QueryKit/Resources/Info.plist @@ -7,7 +7,7 @@ <key>CFBundleExecutable</key> <string>QueryKit</string> <key>CFBundleIdentifier</key> - <string>com.sequelpro.querykit</string> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> diff --git a/Frameworks/QueryKit/Resources/Tests-Info.plist b/Frameworks/QueryKit/Resources/Tests-Info.plist index add26ae7..ddbc4bf7 100644 --- a/Frameworks/QueryKit/Resources/Tests-Info.plist +++ b/Frameworks/QueryKit/Resources/Tests-Info.plist @@ -7,7 +7,7 @@ <key>CFBundleExecutable</key> <string>Tests</string> <key>CFBundleIdentifier</key> - <string>com.sequelpro.querykit.tests</string> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> diff --git a/Frameworks/QueryKit/Tests/QKDeleteQueryTests.h b/Frameworks/QueryKit/Tests/QKDeleteQueryTests.h index ef0e26ca..379fdaf4 100644 --- a/Frameworks/QueryKit/Tests/QKDeleteQueryTests.h +++ b/Frameworks/QueryKit/Tests/QKDeleteQueryTests.h @@ -29,10 +29,10 @@ #import "QKTestCase.h" #import <QueryKit/QueryKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> @interface QKDeleteQueryTests : QKTestCase -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite; ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite; @end diff --git a/Frameworks/QueryKit/Tests/QKDeleteQueryTests.m b/Frameworks/QueryKit/Tests/QKDeleteQueryTests.m index 438f45dd..8862fee5 100644 --- a/Frameworks/QueryKit/Tests/QKDeleteQueryTests.m +++ b/Frameworks/QueryKit/Tests/QKDeleteQueryTests.m @@ -36,7 +36,7 @@ + (id)defaultTestSuite { - SenTestSuite *testSuite = [[SenTestSuite alloc] initWithName:NSStringFromClass(self)]; + XCTestSuite *testSuite = [[XCTestSuite alloc] initWithName:NSStringFromClass(self)]; [self addTestForDatabase:QKDatabaseUnknown withIdentifierQuote:EMPTY_STRING toTestSuite:testSuite]; [self addTestForDatabase:QKDatabaseMySQL withIdentifierQuote:QKMySQLIdentifierQuote toTestSuite:testSuite]; @@ -45,11 +45,11 @@ return [testSuite autorelease]; } -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite { for (NSInvocation *invocation in [self testInvocations]) { - SenTestCase *test = [[QKDeleteQueryTests alloc] initWithInvocation:invocation database:database identifierQuote:quote]; + XCTestCase *test = [[QKDeleteQueryTests alloc] initWithInvocation:invocation database:database identifierQuote:quote]; [testSuite addTest:test]; @@ -77,14 +77,14 @@ - (void)testDeleteQueryTypeIsCorrect { - STAssertTrue([[[self query] query] hasPrefix:@"DELETE"], nil); + XCTAssertTrue([[[self query] query] hasPrefix:@"DELETE"]); } - (void)testDeleteQueryFromTableIsCorrect { NSString *query = [NSString stringWithFormat:@"DELETE FROM %1$@%2$@%1$@", [self identifierQuote], QKTestTableName]; - STAssertTrue([[[self query] query] isEqualToString:query], nil); + XCTAssertTrue([[[self query] query] isEqualToString:query]); } - (void)testDeleteQueryFromDatabaseTableIsCorrect @@ -93,7 +93,7 @@ NSString *query = [NSString stringWithFormat:@"DELETE FROM %1$@%2$@%1$@.%1$@%3$@%1$@", [self identifierQuote], QKTestDatabaseName, QKTestTableName]; - STAssertTrue([[[self query] query] isEqualToString:query] , nil); + XCTAssertTrue([[[self query] query] isEqualToString:query] ); } - (void)testDeleteQueryWithSingleConstraintIsCorrect @@ -102,7 +102,7 @@ NSString *query = [NSString stringWithFormat:@"DELETE FROM %1$@%2$@%1$@ WHERE %1$@%3$@%1$@ %4$@ %5$@", [self identifierQuote], QKTestTableName, QKTestFieldOne, [QKQueryUtilities stringRepresentationOfQueryOperator:QKEqualityOperator], [NSNumber numberWithUnsignedInteger:QKTestParameterOne]]; - STAssertTrue([[[self query] query] isEqualToString:query] , nil); + XCTAssertTrue([[[self query] query] isEqualToString:query] ); } - (void)testDeleteQueryWithMultipleConstraintsIsCorrect @@ -115,7 +115,7 @@ NSString *query = [NSString stringWithFormat:@"DELETE FROM %1$@%2$@%1$@ WHERE %1$@%3$@%1$@ %4$@ %5$@ AND %1$@%6$@%1$@ %7$@ '%8$@'", [self identifierQuote], QKTestTableName, QKTestFieldOne, opOne, [NSNumber numberWithUnsignedInteger:QKTestParameterOne], QKTestFieldTwo, opTwo, QKTestParameterTwo]; - STAssertTrue([[[self query] query] isEqualToString:query] , nil); + XCTAssertTrue([[[self query] query] isEqualToString:query] ); } @end diff --git a/Frameworks/QueryKit/Tests/QKQueryTests.m b/Frameworks/QueryKit/Tests/QKQueryTests.m index 0043e607..2064fad6 100644 --- a/Frameworks/QueryKit/Tests/QKQueryTests.m +++ b/Frameworks/QueryKit/Tests/QKQueryTests.m @@ -30,7 +30,7 @@ #import "QKTestCase.h" #import <QueryKit/QueryKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> @interface QKQueryTests : QKTestCase @end @@ -68,19 +68,19 @@ { [[self query] clear]; - STAssertNil([[self query] table], @"query table"); - STAssertNil([[self query] database], @"query database"); + XCTAssertNil([[self query] table], @"query table"); + XCTAssertNil([[self query] database], @"query database"); - STAssertTrue([[self query] useQuotedIdentifiers], @"query use quoted identifiers"); - STAssertTrue([[[self query] identifierQuote] isEqualToString:EMPTY_STRING], @"query identifier quote"); - STAssertTrue([[[self query] fields] count] == 0, @"query fields"); - STAssertTrue([[[self query] parameters] count] == 0, @"query parameters"); - STAssertTrue([[[self query] updateParameters] count] == 0, @"query update parameters"); - STAssertTrue([[[self query] groupByFields] count] == 0, @"query group by fields"); - STAssertTrue([[[self query] orderByFields] count] == 0, @"query order by fields"); + XCTAssertTrue([[self query] useQuotedIdentifiers], @"query use quoted identifiers"); + XCTAssertTrue([[[self query] identifierQuote] isEqualToString:EMPTY_STRING], @"query identifier quote"); + XCTAssertTrue([[[self query] fields] count] == 0, @"query fields"); + XCTAssertTrue([[[self query] parameters] count] == 0, @"query parameters"); + XCTAssertTrue([[[self query] updateParameters] count] == 0, @"query update parameters"); + XCTAssertTrue([[[self query] groupByFields] count] == 0, @"query group by fields"); + XCTAssertTrue([[[self query] orderByFields] count] == 0, @"query order by fields"); - STAssertEquals([[self query] queryType], QKUnknownQuery, @"query type"); - STAssertEquals([[self query] queryDatabase], QKDatabaseUnknown, @"query database"); + XCTAssertEqual([[self query] queryType], QKUnknownQuery, @"query type"); + XCTAssertEqual([[self query] queryDatabase], QKDatabaseUnknown, @"query database"); } @end diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.h b/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.h index 9a1349d8..f7966a66 100644 --- a/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.h +++ b/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.h @@ -29,10 +29,10 @@ #import "QKTestCase.h" #import <QueryKit/QueryKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> @interface QKSelectQueryGroupByTests : QKTestCase -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite; ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite; @end diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m b/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m index d8e627bc..76aa1a80 100644 --- a/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m +++ b/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m @@ -36,7 +36,7 @@ + (id)defaultTestSuite { - SenTestSuite *testSuite = [[SenTestSuite alloc] initWithName:NSStringFromClass(self)]; + XCTestSuite *testSuite = [[XCTestSuite alloc] initWithName:NSStringFromClass(self)]; [self addTestForDatabase:QKDatabaseUnknown withIdentifierQuote:EMPTY_STRING toTestSuite:testSuite]; [self addTestForDatabase:QKDatabaseMySQL withIdentifierQuote:QKMySQLIdentifierQuote toTestSuite:testSuite]; @@ -45,11 +45,11 @@ return [testSuite autorelease]; } -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite { for (NSInvocation *invocation in [self testInvocations]) { - SenTestCase *test = [[QKSelectQueryGroupByTests alloc] initWithInvocation:invocation database:database identifierQuote:quote]; + XCTestCase *test = [[QKSelectQueryGroupByTests alloc] initWithInvocation:invocation database:database identifierQuote:quote]; [testSuite addTest:test]; @@ -78,7 +78,7 @@ - (void)testSelectQueryTypeIsCorrect { - STAssertTrue([[[self query] query] hasPrefix:@"SELECT"], nil); + XCTAssertTrue([[[self query] query] hasPrefix:@"SELECT"]); } - (void)testSelectQueryGroupByIsCorrect @@ -87,7 +87,7 @@ NSString *query = [NSString stringWithFormat:@"GROUP BY %1$@%2$@%1$@", [self identifierQuote], QKTestFieldOne]; - STAssertTrue([[[self query] query] hasSuffix:query], nil); + XCTAssertTrue([[[self query] query] hasSuffix:query]); } - (void)testSelectQueryGroupByMultipleFieldsIsCorrect @@ -96,7 +96,7 @@ NSString *query = [NSString stringWithFormat:@"GROUP BY %1$@%2$@%1$@, %1$@%3$@%1$@", [self identifierQuote], QKTestFieldOne, QKTestFieldTwo]; - STAssertTrue([[[self query] query] hasSuffix:query], nil); + XCTAssertTrue([[[self query] query] hasSuffix:query]); } @end diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.h b/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.h index efd7eb2f..ffca6929 100644 --- a/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.h +++ b/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.h @@ -29,10 +29,10 @@ #import "QKTestCase.h" #import <QueryKit/QueryKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> @interface QKSelectQueryOrderByTests : QKTestCase -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite; ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite; @end diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m b/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m index b6847d11..a1be1d0c 100644 --- a/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m +++ b/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m @@ -36,7 +36,7 @@ + (id)defaultTestSuite { - SenTestSuite *testSuite = [[SenTestSuite alloc] initWithName:NSStringFromClass(self)]; + XCTestSuite *testSuite = [[XCTestSuite alloc] initWithName:NSStringFromClass(self)]; [self addTestForDatabase:QKDatabaseUnknown withIdentifierQuote:EMPTY_STRING toTestSuite:testSuite]; [self addTestForDatabase:QKDatabaseMySQL withIdentifierQuote:QKMySQLIdentifierQuote toTestSuite:testSuite]; @@ -45,11 +45,11 @@ return [testSuite autorelease]; } -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite { for (NSInvocation *invocation in [self testInvocations]) { - SenTestCase *test = [[QKSelectQueryOrderByTests alloc] initWithInvocation:invocation database:database identifierQuote:quote]; + XCTestCase *test = [[QKSelectQueryOrderByTests alloc] initWithInvocation:invocation database:database identifierQuote:quote]; [testSuite addTest:test]; @@ -78,7 +78,7 @@ - (void)testSelectQueryTypeIsCorrect { - STAssertTrue([[[self query] query] hasPrefix:@"SELECT"], nil); + XCTAssertTrue([[[self query] query] hasPrefix:@"SELECT"]); } - (void)testSelectQueryOrderByAscendingIsCorrect @@ -87,7 +87,7 @@ NSString *query = [NSString stringWithFormat:@"ORDER BY %1$@%2$@%1$@ ASC", [self identifierQuote], QKTestFieldOne]; - STAssertTrue([[[self query] query] hasSuffix:query], nil); + XCTAssertTrue([[[self query] query] hasSuffix:query]); } - (void)testSelectQueryOrderByMultipleFieldsAscendingIsCorrect @@ -97,7 +97,7 @@ NSString *query = [NSString stringWithFormat:@"ORDER BY %1$@%2$@%1$@ ASC, %1$@%3$@%1$@ ASC", [self identifierQuote], QKTestFieldOne, QKTestFieldTwo]; - STAssertTrue([[[self query] query] hasSuffix:query], nil); + XCTAssertTrue([[[self query] query] hasSuffix:query]); } - (void)testSelectQueryOrderByDescendingIsCorrect @@ -106,7 +106,7 @@ NSString *query = [NSString stringWithFormat:@"ORDER BY %1$@%2$@%1$@ DESC", [self identifierQuote], QKTestFieldOne]; - STAssertTrue([[[self query] query] hasSuffix:query], nil); + XCTAssertTrue([[[self query] query] hasSuffix:query]); } - (void)testSelectQueryOrderByMultipleFieldsDescendingIsCorrect @@ -116,7 +116,7 @@ NSString *query = [NSString stringWithFormat:@"ORDER BY %1$@%2$@%1$@ DESC, %1$@%3$@%1$@ DESC", [self identifierQuote], QKTestFieldOne, QKTestFieldTwo]; - STAssertTrue([[[self query] query] hasSuffix:query], nil); + XCTAssertTrue([[[self query] query] hasSuffix:query]); } @end diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryTests.h b/Frameworks/QueryKit/Tests/QKSelectQueryTests.h index 5845ad06..43eda806 100644 --- a/Frameworks/QueryKit/Tests/QKSelectQueryTests.h +++ b/Frameworks/QueryKit/Tests/QKSelectQueryTests.h @@ -29,10 +29,10 @@ #import "QKTestCase.h" #import <QueryKit/QueryKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> @interface QKSelectQueryTests : QKTestCase -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite; ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite; @end diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryTests.m b/Frameworks/QueryKit/Tests/QKSelectQueryTests.m index 0f1153c6..ec5328be 100644 --- a/Frameworks/QueryKit/Tests/QKSelectQueryTests.m +++ b/Frameworks/QueryKit/Tests/QKSelectQueryTests.m @@ -36,7 +36,7 @@ + (id)defaultTestSuite { - SenTestSuite *testSuite = [[SenTestSuite alloc] initWithName:NSStringFromClass(self)]; + XCTestSuite *testSuite = [[XCTestSuite alloc] initWithName:NSStringFromClass(self)]; [self addTestForDatabase:QKDatabaseUnknown withIdentifierQuote:EMPTY_STRING toTestSuite:testSuite]; [self addTestForDatabase:QKDatabaseMySQL withIdentifierQuote:QKMySQLIdentifierQuote toTestSuite:testSuite]; @@ -45,11 +45,11 @@ return [testSuite autorelease]; } -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite { for (NSInvocation *invocation in [self testInvocations]) { - SenTestCase *test = [[QKSelectQueryTests alloc] initWithInvocation:invocation database:database identifierQuote:quote]; + XCTestCase *test = [[QKSelectQueryTests alloc] initWithInvocation:invocation database:database identifierQuote:quote]; [testSuite addTest:test]; @@ -82,14 +82,14 @@ - (void)testSelectQueryTypeIsCorrect { - STAssertTrue([[[self query] query] hasPrefix:@"SELECT"], nil); + XCTAssertTrue([[[self query] query] hasPrefix:@"SELECT"]); } - (void)testSelectQueryFieldIsCorrect { NSString *query = [NSString stringWithFormat:@"SELECT %1$@%2$@%1$@", [self identifierQuote], QKTestFieldOne]; - STAssertTrue([[[self query] query] hasPrefix:query], nil); + XCTAssertTrue([[[self query] query] hasPrefix:query]); } - (void)testSelectQueryFromDatabaseAndTableIsCorrect @@ -98,21 +98,21 @@ NSString *query = [NSString stringWithFormat:@"FROM %1$@%2$@%1$@.%1$@%3$@%1$@", [self identifierQuote], QKTestDatabaseName, QKTestTableName]; - STAssertTrue([[[self query] query] rangeOfString:query].location != NSNotFound, nil); + XCTAssertTrue([[[self query] query] rangeOfString:query].location != NSNotFound); } - (void)testSelectQueryMultipleFieldsAreCorrect { NSString *query = [NSString stringWithFormat:@"SELECT %1$@%2$@%1$@, %1$@%3$@%1$@, %1$@%4$@%1$@, %1$@%5$@%1$@", [self identifierQuote], QKTestFieldOne, QKTestFieldTwo, QKTestFieldThree, QKTestFieldFour]; - STAssertTrue([[[self query] query] hasPrefix:query], nil); + XCTAssertTrue([[[self query] query] hasPrefix:query]); } - (void)testSelectQueryConstraintsAreCorrect { NSString *query = [NSString stringWithFormat:@"WHERE %1$@%2$@%1$@ %3$@ %4$@", [self identifierQuote], QKTestFieldOne, [QKQueryUtilities stringRepresentationOfQueryOperator:QKEqualityOperator], [NSNumber numberWithUnsignedInteger:QKTestParameterOne]]; - STAssertTrue(([[[self query] query] rangeOfString:query].location != NSNotFound), nil); + XCTAssertTrue(([[[self query] query] rangeOfString:query].location != NSNotFound)); } @end diff --git a/Frameworks/QueryKit/Tests/QKTestCase.h b/Frameworks/QueryKit/Tests/QKTestCase.h index 47efec04..baa4f050 100644 --- a/Frameworks/QueryKit/Tests/QKTestCase.h +++ b/Frameworks/QueryKit/Tests/QKTestCase.h @@ -27,9 +27,9 @@ // OTHER DEALINGS IN THE SOFTWARE. #import <QueryKit/QueryKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> -@interface QKTestCase : SenTestCase +@interface QKTestCase : XCTestCase { @private QKQuery *_query; diff --git a/Frameworks/QueryKit/Tests/QKUpdateQueryTests.h b/Frameworks/QueryKit/Tests/QKUpdateQueryTests.h index aede8979..7c3ea7c5 100644 --- a/Frameworks/QueryKit/Tests/QKUpdateQueryTests.h +++ b/Frameworks/QueryKit/Tests/QKUpdateQueryTests.h @@ -29,10 +29,10 @@ #import "QKTestCase.h" #import <QueryKit/QueryKit.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> @interface QKUpdateQueryTests : QKTestCase -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite; ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite; @end diff --git a/Frameworks/QueryKit/Tests/QKUpdateQueryTests.m b/Frameworks/QueryKit/Tests/QKUpdateQueryTests.m index 1beff6d5..039840bb 100644 --- a/Frameworks/QueryKit/Tests/QKUpdateQueryTests.m +++ b/Frameworks/QueryKit/Tests/QKUpdateQueryTests.m @@ -36,7 +36,7 @@ + (id)defaultTestSuite { - SenTestSuite *testSuite = [[SenTestSuite alloc] initWithName:NSStringFromClass(self)]; + XCTestSuite *testSuite = [[XCTestSuite alloc] initWithName:NSStringFromClass(self)]; [self addTestForDatabase:QKDatabaseUnknown withIdentifierQuote:EMPTY_STRING toTestSuite:testSuite]; [self addTestForDatabase:QKDatabaseMySQL withIdentifierQuote:QKMySQLIdentifierQuote toTestSuite:testSuite]; @@ -45,11 +45,11 @@ return [testSuite autorelease]; } -+ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(SenTestSuite *)testSuite ++ (void)addTestForDatabase:(QKQueryDatabase)database withIdentifierQuote:(NSString *)quote toTestSuite:(XCTestSuite *)testSuite { for (NSInvocation *invocation in [self testInvocations]) { - SenTestCase *test = [[NSClassFromString(@"QKUpdateQueryTests") alloc] initWithInvocation:invocation database:database identifierQuote:quote]; + XCTestCase *test = [[NSClassFromString(@"QKUpdateQueryTests") alloc] initWithInvocation:invocation database:database identifierQuote:quote]; [testSuite addTest:test]; @@ -81,7 +81,7 @@ - (void)testUpdateQueryTypeIsCorrect { - STAssertTrue([[[self query] query] hasPrefix:@"UPDATE"], nil); + XCTAssertTrue([[[self query] query] hasPrefix:@"UPDATE"]); } - (void)testUpdateQueryUsingDatabaseAndTableIsCorrect @@ -90,21 +90,21 @@ NSString *query = [NSString stringWithFormat:@"UPDATE %1$@%2$@%1$@.%1$@%3$@%1$@", [self identifierQuote], QKTestDatabaseName, QKTestTableName]; - STAssertTrue([[[self query] query] hasPrefix:query], nil); + XCTAssertTrue([[[self query] query] hasPrefix:query]); } - (void)testUpdateQueryFieldsAreCorrect { NSString *query = [NSString stringWithFormat:@"UPDATE %1$@%2$@%1$@ SET %1$@%3$@%1$@ = '%4$@', %1$@%5$@%1$@ = '%6$@'", [self identifierQuote], QKTestTableName, QKTestFieldOne, QKTestUpdateValueOne, QKTestFieldTwo, QKTestUpdateValueTwo]; - STAssertTrue([[[self query] query] hasPrefix:query], nil); + XCTAssertTrue([[[self query] query] hasPrefix:query]); } - (void)testUpdateQueryConstraintIsCorrect { NSString *query = [NSString stringWithFormat:@"WHERE %1$@%2$@%1$@ %3$@ %4$@", [self identifierQuote], QKTestFieldOne, [QKQueryUtilities stringRepresentationOfQueryOperator:QKEqualityOperator], [NSNumber numberWithUnsignedInteger:QKTestParameterOne]]; - STAssertTrue(([[[self query] query] rangeOfString:query].location != NSNotFound), nil); + XCTAssertTrue(([[[self query] query] rangeOfString:query].location != NSNotFound)); } @end diff --git a/Frameworks/SPMySQLFramework/Resources/Info.plist b/Frameworks/SPMySQLFramework/Resources/Info.plist index 84b64d04..0932b287 100644 --- a/Frameworks/SPMySQLFramework/Resources/Info.plist +++ b/Frameworks/SPMySQLFramework/Resources/Info.plist @@ -7,7 +7,7 @@ <key>CFBundleExecutable</key> <string>SPMySQL</string> <key>CFBundleIdentifier</key> - <string>com.sequelpro.spmysql</string> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> diff --git a/Frameworks/SPMySQLFramework/SPMySQL Unit Tests/Info.plist b/Frameworks/SPMySQLFramework/SPMySQL Unit Tests/Info.plist index 38544a84..ba72822e 100644 --- a/Frameworks/SPMySQLFramework/SPMySQL Unit Tests/Info.plist +++ b/Frameworks/SPMySQLFramework/SPMySQL Unit Tests/Info.plist @@ -7,7 +7,7 @@ <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> - <string>com.sequelpro.spmysql-unittests</string> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> diff --git a/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj b/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj index 32dca24c..778b97f9 100644 --- a/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj +++ b/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj @@ -500,7 +500,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0720; TargetAttributes = { 507FF1D41BC0D7D300104523 = { CreatedOnToolsVersion = 6.2; @@ -628,6 +628,7 @@ "$(inherited)", "\"$(SRCROOT)/MySQL Client Libraries/lib\"", ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.spmysql; PRODUCT_NAME = SPMySQL; SKIP_INSTALL = YES; WRAPPER_EXTENSION = framework; @@ -652,6 +653,7 @@ "$(inherited)", "\"$(SRCROOT)/MySQL Client Libraries/lib\"", ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.spmysql; PRODUCT_NAME = SPMySQL; SKIP_INSTALL = YES; WRAPPER_EXTENSION = framework; @@ -669,6 +671,7 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -758,6 +761,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.sequelpro.spmysql-unittests"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -788,6 +792,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.sequelpro.spmysql-unittests"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -818,6 +823,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.sequelpro.spmysql-unittests"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Distribution; @@ -880,6 +886,7 @@ "$(inherited)", "\"$(SRCROOT)/MySQL Client Libraries/lib\"", ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.spmysql; PRODUCT_NAME = SPMySQL; SKIP_INSTALL = YES; WRAPPER_EXTENSION = framework; @@ -916,6 +923,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.sequelpro.spmysql-unittests"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = "Unit Testing"; @@ -972,6 +980,7 @@ "$(inherited)", "\"$(SRCROOT)/MySQL Client Libraries/lib\"", ); + PRODUCT_BUNDLE_IDENTIFIER = com.sequelpro.spmysql; PRODUCT_NAME = SPMySQL; SKIP_INSTALL = YES; WRAPPER_EXTENSION = framework; diff --git a/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/xcshareddata/xcschemes/SPMySQL.framework.xcscheme b/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/xcshareddata/xcschemes/SPMySQL.framework.xcscheme new file mode 100644 index 00000000..6b85f25b --- /dev/null +++ b/Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/xcshareddata/xcschemes/SPMySQL.framework.xcscheme @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0720" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DC2EF4F0486A6940098B216" + BuildableName = "SPMySQL.framework" + BlueprintName = "SPMySQL.framework" + ReferencedContainer = "container:SPMySQLFramework.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Unit Testing" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "507FF1D41BC0D7D300104523" + BuildableName = "SPMySQL Unit Tests.xctest" + BlueprintName = "SPMySQL Unit Tests" + ReferencedContainer = "container:SPMySQLFramework.xcodeproj"> + </BuildableReference> + </TestableReference> + </Testables> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DC2EF4F0486A6940098B216" + BuildableName = "SPMySQL.framework" + BlueprintName = "SPMySQL.framework" + ReferencedContainer = "container:SPMySQLFramework.xcodeproj"> + </BuildableReference> + </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DC2EF4F0486A6940098B216" + BuildableName = "SPMySQL.framework" + BlueprintName = "SPMySQL.framework" + ReferencedContainer = "container:SPMySQLFramework.xcodeproj"> + </BuildableReference> + </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "8DC2EF4F0486A6940098B216" + BuildableName = "SPMySQL.framework" + BlueprintName = "SPMySQL.framework" + ReferencedContainer = "container:SPMySQLFramework.xcodeproj"> + </BuildableReference> + </MacroExpansion> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/Source/SPComboPopupButton.m b/Source/SPComboPopupButton.m index 8c090911..3df3d6ec 100644 --- a/Source/SPComboPopupButton.m +++ b/Source/SPComboPopupButton.m @@ -129,9 +129,9 @@ CGContextSaveGState(context); CGContextSetStrokeColor(context, lineColorParts); - CGContextAddRect(context, CGRectMake(boundingLinePosition - 0.5, boundsRect.origin.y + heightIndent, 1.f, boundsRect.size.height - abs(2 * heightIndent))); + CGContextAddRect(context, CGRectMake(boundingLinePosition - 0.5, boundsRect.origin.y + heightIndent, 1.f, boundsRect.size.height - fabs(2 * heightIndent))); CGContextClip(context); - CGContextDrawLinearGradient(context, lineGradient, CGPointMake(boundingLinePosition - 0.5, boundsRect.origin.y + heightIndent), CGPointMake(boundingLinePosition - 0.5, boundsRect.origin.y + boundsRect.size.height - abs(heightIndent)), 0); + CGContextDrawLinearGradient(context, lineGradient, CGPointMake(boundingLinePosition - 0.5, boundsRect.origin.y + heightIndent), CGPointMake(boundingLinePosition - 0.5, boundsRect.origin.y + boundsRect.size.height - fabs(heightIndent)), 0); CGContextRestoreGState(context); CGGradientRelease(lineGradient); @@ -281,7 +281,7 @@ // Custom tracking to be performed - indent the vertical button area slightly - activeRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y + heightIndent, cellFrame.size.width - [(SPComboPopupButton *)controlView lineOffset] + 1, cellFrame.size.height - fabsf(2 * heightIndent)); + activeRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y + heightIndent, cellFrame.size.width - [(SPComboPopupButton *)controlView lineOffset] + 1, cellFrame.size.height - fabs(2 * heightIndent)); // Continue tracking the mouse while it's down, updating the state as it enters and leaves the cell, // until it is released; if still within the cell, perform a click. diff --git a/UnitTests/SPDataAdditionsTests.m b/UnitTests/SPDataAdditionsTests.m index 988267d2..4769e499 100644 --- a/UnitTests/SPDataAdditionsTests.m +++ b/UnitTests/SPDataAdditionsTests.m @@ -29,11 +29,11 @@ // More info at <https://github.com/sequelpro/sequelpro> #import <Cocoa/Cocoa.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> #import "SPDataAdditions.h" #import <errno.h> -@interface SPDataAdditionsTests : SenTestCase +@interface SPDataAdditionsTests : XCTestCase - (void)testSha1Hash; - (void)testDataEncryptedWithPassword; @@ -53,7 +53,7 @@ NSString *input = @"Hello World!"; unsigned char bytes[] = {0x2e,0xf7,0xbd,0xe6,0x08,0xce,0x54,0x04,0xe9,0x7d,0x5f,0x04,0x2f,0x95,0xf8,0x9f,0x1c,0x23,0x28,0x71}; - STAssertTrue(memcmp([[[input dataUsingEncoding:NSUTF8StringEncoding] sha1Hash] bytes], bytes, 20) == 0, @"SHA1 simple hash from ASCII text"); + XCTAssertTrue(memcmp([[[input dataUsingEncoding:NSUTF8StringEncoding] sha1Hash] bytes], bytes, 20) == 0, @"SHA1 simple hash from ASCII text"); } // 16MB of all 8bit values { @@ -65,14 +65,14 @@ NSData *input = [NSData dataWithBytesNoCopy:buf length:bufSz]; NSString *result = @"25E05EB8E9E2B06036DF4026630FE01A19BF0F16"; - STAssertEqualObjects([[input sha1Hash] dataToHexString], result, @"SHA1 hash from full ASCII range"); + XCTAssertEqualObjects([[input sha1Hash] dataToHexString], result, @"SHA1 hash from full ASCII range"); } // empty hash { NSData *input = [NSData data]; NSString *result = @"DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"; - STAssertEqualObjects([[input sha1Hash] dataToHexString], result, @"SHA1 hash from empty data"); + XCTAssertEqualObjects([[input sha1Hash] dataToHexString], result, @"SHA1 hash from empty data"); } // test with > 4GB data (other code path) // HFS+ does not support sparse files, so enable this one only if you have enough disk space. @@ -109,7 +109,7 @@ NSData *input = [@"føöbärbãz" dataUsingEncoding:NSUTF8StringEncoding]; NSString *result = @"8A8B6142281950CBB9B01C9DF0DADB0BDAE2D0E1"; - STAssertEqualObjects([[input sha1Hash] dataToHexString], result, @"SHA1 hash of UTF-8 string"); + XCTAssertEqualObjects([[input sha1Hash] dataToHexString], result, @"SHA1 hash of UTF-8 string"); } } @@ -123,11 +123,11 @@ NSData *encrypted = [raw dataEncryptedWithPassword:password]; //check that our encrypted data is not the plaintext data NSData *encCore = [encrypted subdataWithRange:NSMakeRange(16, [raw length])]; - STAssertFalse([encCore isEqualToData:raw], @"encrypted equal to plain text!"); + XCTAssertFalse([encCore isEqualToData:raw], @"encrypted equal to plain text!"); //decrypt again and verify NSData *decrypted = [encrypted dataDecryptedWithPassword:password]; - STAssertEqualObjects(decrypted, raw, @"decrypted data not equal to plaintext data!"); + XCTAssertEqualObjects(decrypted, raw, @"decrypted data not equal to plaintext data!"); } - (void)testDataEncryptedWithKeyIV @@ -144,7 +144,7 @@ { @try { [raw dataEncryptedWithKey:[@"password" dataUsingEncoding:NSASCIIStringEncoding] IV:iv]; - STFail(@"Password should not be a valid key!"); + XCTFail(@"Password should not be a valid key!"); } @catch (NSException *exception) { //expected @@ -154,7 +154,7 @@ { @try { [raw dataEncryptedWithKey:key IV:[NSData data]]; - STFail(@"Empty IV should throw exception!"); + XCTFail(@"Empty IV should throw exception!"); } @catch (NSException *exception) { // expected @@ -171,7 +171,7 @@ 0x1d, 0x9f, 0x0c, 0x7a }; // reference data generated with OpenSSL NSData *expData = [NSData dataWithBytesNoCopy:expect length:sizeof(expect) freeWhenDone:NO]; - STAssertEqualObjects(enc, expData, @"Encryption of empty data"); + XCTAssertEqualObjects(enc, expData, @"Encryption of empty data"); } //simple encryption test { @@ -185,7 +185,7 @@ 0x44, 0x32, 0xb3, 0xda, 0x42, 0x58, 0x29, 0x78, 0xc3 }; // reference data generated with OpenSSL NSData *expData = [NSData dataWithBytesNoCopy:expect length:sizeof(expect) freeWhenDone:NO]; - STAssertEqualObjects(enc, expData, @"Simple encryption test"); + XCTAssertEqualObjects(enc, expData, @"Simple encryption test"); } } @@ -205,7 +205,7 @@ NSData *decrypted = [encData dataDecryptedWithPassword:@""]; - STAssertEqualObjects(decrypted, raw, @"Decrypt simple data encrypted with empty password"); + XCTAssertEqualObjects(decrypted, raw, @"Decrypt simple data encrypted with empty password"); } - (void)testDataDecryptedWithKey @@ -229,7 +229,7 @@ { @try { [encData dataDecryptedWithKey:[NSData data]]; - STFail(@"Invalid key length!"); + XCTFail(@"Invalid key length!"); } @catch (NSException *exception) { //expected @@ -239,7 +239,7 @@ { @try { [[@"Hello World!" dataUsingEncoding:NSASCIIStringEncoding] dataDecryptedWithKey:key]; - STFail(@"Invalid data length!"); + XCTFail(@"Invalid data length!"); } @catch (NSException *exception) { //expected @@ -248,17 +248,17 @@ // wrong data with valid length { NSData *inp = [@"12345678901234567890123456789012" dataUsingEncoding:NSASCIIStringEncoding]; - STAssertNil([inp dataDecryptedWithKey:key], @"Trying to decrypt invalid data."); + XCTAssertNil([inp dataDecryptedWithKey:key], @"Trying to decrypt invalid data."); } // wrong data with invalid length { NSData *inp = [@"12345678901234567890123456789012345678901234567" dataUsingEncoding:NSASCIIStringEncoding]; - STAssertNil([inp dataDecryptedWithKey:key], @"Trying to decrypt data with invalid length."); + XCTAssertNil([inp dataDecryptedWithKey:key], @"Trying to decrypt data with invalid length."); } // simple decryption test { NSData *decrypted = [encData dataDecryptedWithKey:key]; - STAssertEqualObjects(decrypted, raw, @"Simple Decryption test"); + XCTAssertEqualObjects(decrypted, raw, @"Simple Decryption test"); } // malicious message test { @@ -274,7 +274,7 @@ @try { [_encData dataDecryptedWithKey:key]; - STFail(@"Malicious message with invalid data length"); + XCTFail(@"Malicious message with invalid data length"); } @catch (NSException *exception) { //expected @@ -291,7 +291,7 @@ [data enumerateLinesBreakingAt:SPLineTerminatorAny withBlock:^(NSRange line, BOOL *stop) { invocations++; }]; - STAssertTrue(invocations==0, @"Empty data never invokes block"); + XCTAssertTrue(invocations==0, @"Empty data never invokes block"); } //simple unix file { @@ -301,15 +301,15 @@ [data enumerateLinesBreakingAt:SPLineTerminatorAny withBlock:^(NSRange line, BOOL *stop) { switch (invocations) { case 0: - STAssertEquals(line, NSMakeRange(0, 3), @"range of first line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(0, 3)), @"range of first line"); break; case 1: - STAssertEquals(line, NSMakeRange(4, 5), @"range of second line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(4, 5)), @"range of second line"); break; } invocations++; }]; - STAssertTrue(invocations==2, @"File with two lines, terminated with empty line"); + XCTAssertTrue(invocations==2, @"File with two lines, terminated with empty line"); } //simple windows file without ending empty line { @@ -319,18 +319,18 @@ [data enumerateLinesBreakingAt:SPLineTerminatorAny withBlock:^(NSRange line, BOOL *stop) { switch (invocations) { case 0: - STAssertEquals(line, NSMakeRange(0, 1), @"range of first line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(0, 1)), @"range of first line"); break; case 1: - STAssertEquals(line, NSMakeRange(3, 7), @"range of second line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(3, 7)), @"range of second line"); break; case 2: - STAssertEquals(line, NSMakeRange(12, 4), @"range of third line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(12, 4)), @"range of third line"); break; } invocations++; }]; - STAssertTrue(invocations==3, @"File with three lines, CRLF, terminated with empty line"); + XCTAssertTrue(invocations==3, @"File with three lines, CRLF, terminated with empty line"); } //empty lines with all 3 endings { @@ -340,18 +340,18 @@ [data enumerateLinesBreakingAt:SPLineTerminatorAny withBlock:^(NSRange line, BOOL *stop) { switch (invocations) { case 0: - STAssertEquals(line, NSMakeRange(0, 0), @"range of first line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(0, 0)), @"range of first line"); break; case 1: - STAssertEquals(line, NSMakeRange(1, 0), @"range of second line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(1, 0)), @"range of second line"); break; case 2: - STAssertEquals(line, NSMakeRange(3, 0), @"range of third line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(3, 0)), @"range of third line"); break; } invocations++; }]; - STAssertTrue(invocations==3, @"LF, CRLF and CR mixed"); + XCTAssertTrue(invocations==3, @"LF, CRLF and CR mixed"); } //looking for specific line breaks only { @@ -361,15 +361,15 @@ [data enumerateLinesBreakingAt:SPLineTerminatorCRLF withBlock:^(NSRange line, BOOL *stop) { switch (invocations) { case 0: - STAssertEquals(line, NSMakeRange(0, 7), @"range of first line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(0, 7)), @"range of first line"); break; case 1: - STAssertEquals(line, NSMakeRange(9, 4), @"range of second line"); + XCTAssertTrue(NSEqualRanges(line, NSMakeRange(9, 4)), @"range of second line"); break; } invocations++; }]; - STAssertTrue(invocations==2, @"other line breaks when only CRLF is expected"); + XCTAssertTrue(invocations==2, @"other line breaks when only CRLF is expected"); } //stopping early { @@ -380,7 +380,7 @@ invocations++; *stop = YES; }]; - STAssertTrue(invocations==1, @"File with two lines, stopped after first"); + XCTAssertTrue(invocations==1, @"File with two lines, stopped after first"); } } diff --git a/UnitTests/SPDatabaseActionTest.m b/UnitTests/SPDatabaseActionTest.m index f7704df5..a74dc0f0 100644 --- a/UnitTests/SPDatabaseActionTest.m +++ b/UnitTests/SPDatabaseActionTest.m @@ -29,14 +29,14 @@ // More info at <https://github.com/sequelpro/sequelpro> #import <OCMock/OCMock.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> #import "SPDatabaseAction.h" #import <SPMySQL/SPMySQL.h> -@interface SPDatabaseActionTest : SenTestCase +@interface SPDatabaseActionTest : XCTestCase - (void)testCreateDatabase_01_emptyName; - (void)testCreateDatabase_02_allParams; @@ -53,7 +53,7 @@ SPDatabaseAction *createDb = [[[SPDatabaseAction alloc] init] autorelease]; [createDb setConnection:mockConnection]; - STAssertFalse([createDb createDatabase:@"" withEncoding:nil collation:nil],@"create database = NO with empty db name"); + XCTAssertFalse([createDb createDatabase:@"" withEncoding:nil collation:nil],@"create database = NO with empty db name"); OCMVerifyAll(mockConnection); } @@ -69,7 +69,7 @@ SPDatabaseAction *createDb = [[[SPDatabaseAction alloc] init] autorelease]; [createDb setConnection:mockConnection]; - STAssertTrue([createDb createDatabase:@"target_name" withEncoding:@"utf8" collation:@"utf8_bin_ci"], @"create database return"); + XCTAssertTrue([createDb createDatabase:@"target_name" withEncoding:@"utf8" collation:@"utf8_bin_ci"], @"create database return"); OCMVerifyAll(mockConnection); } @@ -84,7 +84,7 @@ SPDatabaseAction *createDb = [[[SPDatabaseAction alloc] init] autorelease]; [createDb setConnection:mockConnection]; - STAssertTrue([createDb createDatabase:@"target_name" withEncoding:@"" collation:nil], @"create database return"); + XCTAssertTrue([createDb createDatabase:@"target_name" withEncoding:@"" collation:nil], @"create database return"); OCMVerifyAll(mockConnection); } diff --git a/UnitTests/SPMenuAdditionsTests.m b/UnitTests/SPMenuAdditionsTests.m index 83647e6f..7e8b5ecc 100644 --- a/UnitTests/SPMenuAdditionsTests.m +++ b/UnitTests/SPMenuAdditionsTests.m @@ -30,7 +30,7 @@ #import "SPMenuAdditions.h" -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> /** * @class SPMenuAdditionsTests SPMenuAdditionsTests.h @@ -39,7 +39,7 @@ * * SPMenuAdditionsTests tests class. */ -@interface SPMenuAdditionsTests : SenTestCase +@interface SPMenuAdditionsTests : XCTestCase { NSMenu *menu; } @@ -71,7 +71,7 @@ static NSString *SPTestMenuItemTitle = @"Menu Item"; { [menu compatibleRemoveAllItems]; - STAssertFalse([menu numberOfItems], @"The menu should have no menu items."); + XCTAssertFalse([menu numberOfItems], @"The menu should have no menu items."); } @end diff --git a/UnitTests/SPMutableArrayAdditionsTests.m b/UnitTests/SPMutableArrayAdditionsTests.m index e09f00a4..82fec400 100644 --- a/UnitTests/SPMutableArrayAdditionsTests.m +++ b/UnitTests/SPMutableArrayAdditionsTests.m @@ -30,7 +30,7 @@ #import "SPMutableArrayAdditions.h" -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> /** * @class SPMutableArrayAdditionsTest SPMutableArrayAdditionsTest.h @@ -39,7 +39,7 @@ * * SPMutableArrayAdditions tests class. */ -@interface SPMutableArrayAdditionsTests : SenTestCase +@interface SPMutableArrayAdditionsTests : XCTestCase @end @@ -55,7 +55,7 @@ [testArray reverse]; - STAssertEqualObjects(testArray, expectedArray, @"The reversed array should look like: %@, but actually looks like: %@", expectedArray, testArray); + XCTAssertEqualObjects(testArray, expectedArray, @"The reversed array should look like: %@, but actually looks like: %@", expectedArray, testArray); } @end diff --git a/UnitTests/SPParserUtilsTest.m b/UnitTests/SPParserUtilsTest.m index 994b166a..6796a250 100644 --- a/UnitTests/SPParserUtilsTest.m +++ b/UnitTests/SPParserUtilsTest.m @@ -31,11 +31,11 @@ #define USE_APPLICATION_UNIT_TEST 1 #import <Cocoa/Cocoa.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> #include "SPParserUtils.h" -@interface SPParserUtilsTest : SenTestCase +@interface SPParserUtilsTest : XCTestCase - (void)testUtf8strlen; @@ -49,39 +49,39 @@ const char *empty = ""; NSString *emptyString = [NSString stringWithCString:empty encoding:NSUTF8StringEncoding]; - STAssertEquals(utf8strlen(empty),[emptyString length], @"empty string"); + XCTAssertEqual(utf8strlen(empty),[emptyString length], @"empty string"); // This is just a little safeguard. // If any of those conditions fail, all of the following assumptions are moot. const char *charSeq = "\xF0\x9F\x8D\x8F"; //🍏 NSString *charString = [NSString stringWithCString:charSeq encoding:NSUTF8StringEncoding]; - STAssertEquals(strlen(charSeq), (size_t)4, @"assumption about storage for binary C string"); - STAssertEquals([charString length], (NSUInteger)2, @"assumption about NSString internal storage of string"); + XCTAssertEqual(strlen(charSeq), (size_t)4, @"assumption about storage for binary C string"); + XCTAssertEqual([charString length], (NSUInteger)2, @"assumption about NSString internal storage of string"); const char *singleByteSeq = "Hello World!"; NSString *singleByteString = [NSString stringWithCString:singleByteSeq encoding:NSUTF8StringEncoding]; - STAssertEquals(utf8strlen(singleByteSeq), [singleByteString length], @"ASCII UTF-8 subset"); + XCTAssertEqual(utf8strlen(singleByteSeq), [singleByteString length], @"ASCII UTF-8 subset"); const char *twoByteSeq = "H\xC3\xA4ll\xC3\xB6 W\xC3\x9Crld\xC3\x9F!"; // Hällö WÜrldß! NSString *twoByteString = [NSString stringWithCString:twoByteSeq encoding:NSUTF8StringEncoding]; - STAssertEquals(utf8strlen(twoByteSeq), [twoByteString length], @"String containing two-byte utf8 characters"); + XCTAssertEqual(utf8strlen(twoByteSeq), [twoByteString length], @"String containing two-byte utf8 characters"); const char *threeByteSeq = "\xE3\x81\x93.\xE3\x82\x93.\xE3\x81\xAB.\xE3\x81\xA1.\xE3\x81\xAF"; // こ.ん.に.ち.は NSString *threeByteString = [NSString stringWithCString:threeByteSeq encoding:NSUTF8StringEncoding]; - STAssertEquals(utf8strlen(threeByteSeq), [threeByteString length], @"String containing three-byte utf8 characters"); + XCTAssertEqual(utf8strlen(threeByteSeq), [threeByteString length], @"String containing three-byte utf8 characters"); const char *fourByteSeq = "\xF0\x9F\x8D\x8F\xF0\x9F\x8D\x8B\xF0\x9F\x8D\x92"; //🍏🍋🍒 NSString *fourByteString = [NSString stringWithCString:fourByteSeq encoding:NSUTF8StringEncoding]; - STAssertEquals(utf8strlen(fourByteSeq), [fourByteString length], @"String containing only 4-byte utf8 characters (outside BMP)"); + XCTAssertEqual(utf8strlen(fourByteSeq), [fourByteString length], @"String containing only 4-byte utf8 characters (outside BMP)"); const char *mixedSeq = "\xE3\x81\x82\xE3\x82\x81\xE3\x80\x90\xE9\xA3\xB4\xE3\x80\x91\xF0\x9F\x8D\xAD \xE2\x89\x88 S\xC3\xBC\xC3\x9Figkeit"; // あめ【飴】🍭 ≈ Süßigkeit NSString *mixedString = [NSString stringWithCString:mixedSeq encoding:NSUTF8StringEncoding]; - STAssertEquals(utf8strlen(mixedSeq), [mixedString length], @"utf8 characters with all 4 lengths mixed together."); + XCTAssertEqual(utf8strlen(mixedSeq), [mixedString length], @"utf8 characters with all 4 lengths mixed together."); //composed vs. decomposed chars const char *decompSeq = "\xC3\xA4 - a\xCC\x88"; // ä - ä NSString *decompString = [NSString stringWithCString:decompSeq encoding:NSUTF8StringEncoding]; - STAssertEquals(utf8strlen(decompSeq), [decompString length], @"\"LATIN SMALL LETTER A WITH DIAERESIS\" vs. \"LATIN SMALL LETTER A\" + \"COMBINING DIAERESIS\""); + XCTAssertEqual(utf8strlen(decompSeq), [decompString length], @"\"LATIN SMALL LETTER A WITH DIAERESIS\" vs. \"LATIN SMALL LETTER A\" + \"COMBINING DIAERESIS\""); } @end diff --git a/UnitTests/SPStringAdditionsTests.m b/UnitTests/SPStringAdditionsTests.m index 00cbdc14..eca9f7ab 100644 --- a/UnitTests/SPStringAdditionsTests.m +++ b/UnitTests/SPStringAdditionsTests.m @@ -31,9 +31,9 @@ #import "SPStringAdditions.h" #import "RegexKitLite.h" -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> -@interface SPStringAdditionsTests : SenTestCase +@interface SPStringAdditionsTests : XCTestCase - (void)testStringByRemovingCharactersInSet; - (void)testStringWithNewUUID; @@ -65,12 +65,12 @@ static NSRange RangeFromArray(NSArray *a,NSUInteger idx); NSString *expectedUTFString = @"In der Krze liegt die Wrz"; NSString *expectedASCIIString = @"this is ig rzy test string with some rndom spes nd quotes"; - STAssertEqualObjects([actualASCIIString stringByRemovingCharactersInSet:junk], + XCTAssertEqualObjects([actualASCIIString stringByRemovingCharactersInSet:junk], expectedASCIIString, @"The following characters should have been removed %@", charsToRemove); - STAssertEqualObjects([actualUTFString stringByRemovingCharactersInSet:junk], + XCTAssertEqualObjects([actualUTFString stringByRemovingCharactersInSet:junk], expectedUTFString, @"The following characters should have been removed %@", charsToRemove); @@ -83,7 +83,7 @@ static NSRange RangeFromArray(NSArray *a,NSUInteger idx); { NSString *uuid = [NSString stringWithNewUUID]; - STAssertTrue([uuid isMatchedByRegex:@"[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}"], @"UUID %@ doesn't match regex", uuid); + XCTAssertTrue([uuid isMatchedByRegex:@"[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}"], @"UUID %@ doesn't match regex", uuid); } /** @@ -96,7 +96,7 @@ static NSRange RangeFromArray(NSArray *a,NSUInteger idx); NSString *actualSyntax = [originalSyntax createViewSyntaxPrettifier]; - STAssertEqualObjects([actualSyntax description], [expectedSyntax description], @"Actual view syntax '%@' does not equal expected syntax '%@'", actualSyntax, expectedSyntax); + XCTAssertEqualObjects([actualSyntax description], [expectedSyntax description], @"Actual view syntax '%@' does not equal expected syntax '%@'", actualSyntax, expectedSyntax); } - (void)testNonConsecutivelySearchStringMatchingRanges @@ -104,48 +104,48 @@ static NSRange RangeFromArray(NSArray *a,NSUInteger idx); //basic tests { NSArray *matches = nil; - STAssertTrue([@"" nonConsecutivelySearchString:@"" matchingRanges:&matches], @"Equality of empty strings"); - STAssertTrue(([matches count] == 1) && NSEqualRanges(NSMakeRange(0, 0), RangeFromArray(matches, 0)), @"Returned matches in empty string"); + XCTAssertTrue([@"" nonConsecutivelySearchString:@"" matchingRanges:&matches], @"Equality of empty strings"); + XCTAssertTrue(([matches count] == 1) && NSEqualRanges(NSMakeRange(0, 0), RangeFromArray(matches, 0)), @"Returned matches in empty string"); } { NSArray *matches = (void *)0xdeadbeef; - STAssertFalse([@"" nonConsecutivelySearchString:@"R" matchingRanges:&matches], @"Inequality with empty left side"); - STAssertTrue((matches == (void *)0xdeadbeef), @"out variable not touched by mismatch"); + XCTAssertFalse([@"" nonConsecutivelySearchString:@"R" matchingRanges:&matches], @"Inequality with empty left side"); + XCTAssertTrue((matches == (void *)0xdeadbeef), @"out variable not touched by mismatch"); } - STAssertFalse([@"L" nonConsecutivelySearchString:@"" matchingRanges:NULL], @"Inequality with empty right side"); + XCTAssertFalse([@"L" nonConsecutivelySearchString:@"" matchingRanges:NULL], @"Inequality with empty right side"); { NSArray *matches = nil; - STAssertTrue([@"left" nonConsecutivelySearchString:@"le" matchingRanges:&matches], @"Anchored match left"); - STAssertTrue(([matches count] == 1) && NSEqualRanges(NSMakeRange(0, 2), RangeFromArray(matches, 0)), @"Returned matches in anchored left match"); + XCTAssertTrue([@"left" nonConsecutivelySearchString:@"le" matchingRanges:&matches], @"Anchored match left"); + XCTAssertTrue(([matches count] == 1) && NSEqualRanges(NSMakeRange(0, 2), RangeFromArray(matches, 0)), @"Returned matches in anchored left match"); } { NSArray *matches = nil; - STAssertTrue([@"right" nonConsecutivelySearchString:@"ht" matchingRanges:&matches], @"Anchored match right"); - STAssertTrue(([matches count] == 1) && NSEqualRanges(NSMakeRange(3, 2), RangeFromArray(matches, 0)), @"Returned matches in anchroed right match"); + XCTAssertTrue([@"right" nonConsecutivelySearchString:@"ht" matchingRanges:&matches], @"Anchored match right"); + XCTAssertTrue(([matches count] == 1) && NSEqualRanges(NSMakeRange(3, 2), RangeFromArray(matches, 0)), @"Returned matches in anchroed right match"); } - STAssertFalse([@"ht" nonConsecutivelySearchString:@"right" matchingRanges:NULL], @"Left and Right are not commutative"); + XCTAssertFalse([@"ht" nonConsecutivelySearchString:@"right" matchingRanges:NULL], @"Left and Right are not commutative"); //real tests { NSArray *matches = nil; - STAssertTrue([@"... is not secure anymore!" nonConsecutivelySearchString:@"NSA" matchingRanges:&matches], @"Non-consecutive match, ignoring case"); - STAssertTrue(([matches count] == 3) && + XCTAssertTrue([@"... is not secure anymore!" nonConsecutivelySearchString:@"NSA" matchingRanges:&matches], @"Non-consecutive match, ignoring case"); + XCTAssertTrue(([matches count] == 3) && NSEqualRanges(NSMakeRange( 7, 1), RangeFromArray(matches, 0)) && NSEqualRanges(NSMakeRange(11, 1), RangeFromArray(matches, 1)) && NSEqualRanges(NSMakeRange(18, 1), RangeFromArray(matches, 2)), @"Returned matches in non-consecutive string"); } - STAssertFalse([@"Deoxyribonucleic Acid" nonConsecutivelySearchString:@"DNS" matchingRanges:NULL], @"Non-consecutive mismatch"); + XCTAssertFalse([@"Deoxyribonucleic Acid" nonConsecutivelySearchString:@"DNS" matchingRanges:NULL], @"Non-consecutive mismatch"); { NSArray *matches = nil; - STAssertTrue([@"Turn left, then right at the corner" nonConsecutivelySearchString:@"left right" matchingRanges:&matches], @"Partly consecutive match"); - STAssertTrue(([matches count] == 2) && + XCTAssertTrue([@"Turn left, then right at the corner" nonConsecutivelySearchString:@"left right" matchingRanges:&matches], @"Partly consecutive match"); + XCTAssertTrue(([matches count] == 2) && (NSEqualRanges(NSMakeRange( 5, 4), RangeFromArray(matches, 0))) && (NSEqualRanges(NSMakeRange(15, 6), RangeFromArray(matches, 1))), @"Returned matches in partly-consecutive string"); } @@ -159,8 +159,8 @@ static NSRange RangeFromArray(NSArray *a,NSUInteger idx); // ^^^^^^^ ^ ^ ^ ^ = 5 (after optimizing consecutive atomic matches) // Desired: "central_private_rabbit_park" // ^^^^^^^ ^^^^ = 2 - STAssertTrue([@"central_private_rabbit_park" nonConsecutivelySearchString:@"centralpark" matchingRanges:&matches], @"Optimization partly consecutive match"); - STAssertTrue((([matches count] == 2) && + XCTAssertTrue([@"central_private_rabbit_park" nonConsecutivelySearchString:@"centralpark" matchingRanges:&matches], @"Optimization partly consecutive match"); + XCTAssertTrue((([matches count] == 2) && (NSEqualRanges(NSMakeRange( 0, 7), RangeFromArray(matches, 0))) && (NSEqualRanges(NSMakeRange(23, 4), RangeFromArray(matches, 1)))), @"Returned matches set is minimal"); } @@ -172,8 +172,8 @@ static NSRange RangeFromArray(NSArray *a,NSUInteger idx); // Unoptimized: ^ ^ ^ ^ ^ ^ ^ = 7 // Desired: ^ ^^^ ^^^ = 3 NSArray *matches = nil; - STAssertTrue([@"a.?a?ab?abc?1?12?123?" nonConsecutivelySearchString:@".abc123" matchingRanges:&matches], @"Optimization non-consecutive match"); - STAssertTrue((([matches count] == 3) && + XCTAssertTrue([@"a.?a?ab?abc?1?12?123?" nonConsecutivelySearchString:@".abc123" matchingRanges:&matches], @"Optimization non-consecutive match"); + XCTAssertTrue((([matches count] == 3) && (NSEqualRanges(NSMakeRange( 1, 1), RangeFromArray(matches, 0))) && (NSEqualRanges(NSMakeRange( 8, 3), RangeFromArray(matches, 1))) && (NSEqualRanges(NSMakeRange(17, 3), RangeFromArray(matches, 2)))), @"Returned matches set is minimal (2)"); @@ -184,15 +184,15 @@ static NSRange RangeFromArray(NSArray *a,NSUInteger idx); // LATIN CAPITAL LETTER A == LATIN SMALL LETTER A // LATIN SMALL LETTER O WITH DIAERESIS == LATIN SMALL LETTER O // FULLWIDTH LATIN SMALL LETTER b == LATIN SMALL LETTER B - STAssertTrue([@"A:\xC3\xB6:\xEF\xBD\x82" nonConsecutivelySearchString:@"aob" matchingRanges:NULL], @"Fuzzy matching of defined characters"); + XCTAssertTrue([@"A:\xC3\xB6:\xEF\xBD\x82" nonConsecutivelySearchString:@"aob" matchingRanges:NULL], @"Fuzzy matching of defined characters"); //all bytes on the right are contained on the left, but on a character level "ä" is not contained in "Hütte Ф" - STAssertFalse([@"H\xC3\xBCtte \xD0\xA4" nonConsecutivelySearchString:@"\xC3\xA4" matchingRanges:NULL], @"Mismatch of composed characters with same prefix"); + XCTAssertFalse([@"H\xC3\xBCtte \xD0\xA4" nonConsecutivelySearchString:@"\xC3\xA4" matchingRanges:NULL], @"Mismatch of composed characters with same prefix"); // ":😥:𠘄:" vs "😄" (according to wikipedia "𠘄" is the arachic variant of "印") // TECHNICALLY THIS SHOULD NOT MATCH! // However Apple doesn't correctly handle characters in the 4-Byte UTF range, so let's use this test to check for changes in Apples behaviour :) - STAssertTrue([@":\xF0\x9F\x98\x84:\xF0\xA0\x98\x84:" nonConsecutivelySearchString:@"\xF0\x9F\x98\x84" matchingRanges:NULL], @"Mismatch of composed characters (4-byte) with same prefix"); + XCTAssertTrue([@":\xF0\x9F\x98\x84:\xF0\xA0\x98\x84:" nonConsecutivelySearchString:@"\xF0\x9F\x98\x84" matchingRanges:NULL], @"Mismatch of composed characters (4-byte) with same prefix"); } @@ -200,19 +200,19 @@ static NSRange RangeFromArray(NSArray *a,NSUInteger idx); { { //test against empty string - STAssertEqualObjects([@"" stringByReplacingCharactersInSet:[NSCharacterSet whitespaceCharacterSet] withString:@"x"], @"", @"replacement on empty string must result in empty string"); + XCTAssertEqualObjects([@"" stringByReplacingCharactersInSet:[NSCharacterSet whitespaceCharacterSet] withString:@"x"], @"", @"replacement on empty string must result in empty string"); } { //test match at begin, middle, end / consecutive matches - STAssertEqualObjects([@" ab c " stringByReplacingCharactersInSet:[NSCharacterSet whitespaceCharacterSet] withString:@"_"], @"_ab__c_", @"Testing matches at both end, replacement of consecutive matches"); + XCTAssertEqualObjects([@" ab c " stringByReplacingCharactersInSet:[NSCharacterSet whitespaceCharacterSet] withString:@"_"], @"_ab__c_", @"Testing matches at both end, replacement of consecutive matches"); } { //test replacement of different characters - STAssertEqualObjects([@"ab\r\ncd" stringByReplacingCharactersInSet:[NSCharacterSet newlineCharacterSet] withString:@"*"], @"ab**cd", @"Testing replacement of different characters in set"); + XCTAssertEqualObjects([@"ab\r\ncd" stringByReplacingCharactersInSet:[NSCharacterSet newlineCharacterSet] withString:@"*"], @"ab**cd", @"Testing replacement of different characters in set"); } { // nil for replacement char - STAssertEqualObjects([@"ab\r\ncd" stringByReplacingCharactersInSet:[NSCharacterSet newlineCharacterSet] withString:nil], @"abcd", @"testing replacement with nil"); + XCTAssertEqualObjects([@"ab\r\ncd" stringByReplacingCharactersInSet:[NSCharacterSet newlineCharacterSet] withString:nil], @"abcd", @"testing replacement with nil"); } } diff --git a/UnitTests/SPTableCopyTest.m b/UnitTests/SPTableCopyTest.m index 05ab4a76..563322df 100644 --- a/UnitTests/SPTableCopyTest.m +++ b/UnitTests/SPTableCopyTest.m @@ -31,12 +31,12 @@ #import "SPTableCopy.h" #import <SPMySQL/SPMySQL.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> #import <OCMock/OCMock.h> #define USE_APPLICATION_UNIT_TEST 1 -@interface SPTableCopyTest : SenTestCase +@interface SPTableCopyTest : XCTestCase - (void)testCopyTableFromToWithData; - (void)testCopyTableFromTo_NoPermissions; @@ -88,8 +88,9 @@ { SPTableCopy *tableCopy = [[SPTableCopy alloc] init]; + [tableCopy setConnection:mockConnection]; - STAssertFalse([tableCopy copyTable:@"table_name" from:@"source_db" to:@"target_db"],@"copy operation must fail."); + XCTAssertFalse([tableCopy copyTable:@"table_name" from:@"source_db" to:@"target_db"], @"copy operation must fail."); [tableCopy release]; } diff --git a/UnitTests/SPTableFilterParserTest.m b/UnitTests/SPTableFilterParserTest.m index d5f46969..1ff69e7f 100644 --- a/UnitTests/SPTableFilterParserTest.m +++ b/UnitTests/SPTableFilterParserTest.m @@ -12,9 +12,9 @@ #define USE_APPLICATION_UNIT_TEST 1 #import <Cocoa/Cocoa.h> -#import <SenTestingKit/SenTestingKit.h> +#import <XCTest/XCTest.h> -@interface SPTableFilterParserTest : SenTestCase +@interface SPTableFilterParserTest : XCTestCase - (void)testFilterString; @@ -29,7 +29,7 @@ [p setCurrentField:@"FLD"]; // binary matches as "$BINARY ", eating the one additional whitespace - STAssertEqualObjects([p filterString],@"`FLD` constant string", @"Constant replacement"); + XCTAssertEqualObjects([p filterString],@"`FLD` constant string", @"Constant replacement"); } //simple one argument case with binary { @@ -38,7 +38,7 @@ [p setCaseSensitive:YES]; [p setArgument:@"arg1"]; - STAssertEqualObjects([p filterString], @"`FLD2` = FOO(BINARY arg1)", @"One Argument, $BINARY variable"); + XCTAssertEqualObjects([p filterString], @"`FLD2` = FOO(BINARY arg1)", @"One Argument, $BINARY variable"); } //simple two argument case with explicit current field { @@ -48,7 +48,7 @@ [p setFirstBetweenArgument:@"LA"]; [p setSecondBetweenArgument:@"RA"]; - STAssertEqualObjects([p filterString], @"MIN(`FLD3`,LA) = RA", @"Two Arguments, $CURRENT_FIELD variable"); + XCTAssertEqualObjects([p filterString], @"MIN(`FLD3`,LA) = RA", @"Two Arguments, $CURRENT_FIELD variable"); } } diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index b1521906..aaca3759 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -538,6 +538,13 @@ remoteGlobalIDString = 17E5969E14F307CE0054EE08; remoteInfo = Tests; }; + 29B70BD51C805B2A00D1BE0C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 584D876015140D3500F24774 /* SPMySQLFramework.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 507FF1D51BC0D7D300104523; + remoteInfo = "SPMySQL Unit Tests"; + }; 5847571D120A1C6D0057631F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */; @@ -910,7 +917,7 @@ 29FA88221114619E00D1AF3D /* SPTableTriggers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableTriggers.m; sourceTree = "<group>"; }; 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; - 380F4ED90FC0B50500B0BFD7 /* Unit Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Unit Tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 380F4ED90FC0B50500B0BFD7 /* Unit Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Unit Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 380F4EF40FC0B68F00B0BFD7 /* SPStringAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPStringAdditionsTests.m; sourceTree = "<group>"; }; 384582C30FB95FF800DDACB6 /* func-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "func-small.png"; sourceTree = "<group>"; }; 384582C60FB9603600DDACB6 /* proc-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "proc-small.png"; sourceTree = "<group>"; }; @@ -2364,7 +2371,7 @@ isa = PBXGroup; children = ( 8D15AC370486D014006FF6A4 /* Sequel Pro.app */, - 380F4ED90FC0B50500B0BFD7 /* Unit Tests.octest */, + 380F4ED90FC0B50500B0BFD7 /* Unit Tests.xctest */, 58CDB3360FCE13C900F8ACA3 /* SequelProTunnelAssistant */, 58B906E611BD989A000826E5 /* PSMTabBar.framework */, 58B9096111C3A42B000826E5 /* xibLocalizationPostprocessor */, @@ -2487,6 +2494,7 @@ isa = PBXGroup; children = ( 584D876815140D3500F24774 /* SPMySQL.framework */, + 29B70BD61C805B2A00D1BE0C /* SPMySQL Unit Tests.xctest */, ); name = Products; sourceTree = "<group>"; @@ -2746,8 +2754,8 @@ ); name = "Unit Tests"; productName = "Unit Tests"; - productReference = 380F4ED90FC0B50500B0BFD7 /* Unit Tests.octest */; - productType = "com.apple.product-type.bundle.ocunit-test"; + productReference = 380F4ED90FC0B50500B0BFD7 /* Unit Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; }; 584754C1120A04560057631F /* Sequel Pro QLGenerator */ = { isa = PBXNativeTarget; @@ -2903,6 +2911,13 @@ remoteRef = 17E596A114F307CE0054EE08 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 29B70BD61C805B2A00D1BE0C /* SPMySQL Unit Tests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "SPMySQL Unit Tests.xctest"; + remoteRef = 29B70BD51C805B2A00D1BE0C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 584D876815140D3500F24774 /* SPMySQL.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -3846,7 +3861,7 @@ COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", + "$(inherited)", ); GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; @@ -3861,13 +3876,9 @@ "-framework", Cocoa, "-framework", - SenTestingKit, - "-framework", OCMock, ); PRODUCT_NAME = "Unit Tests"; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; }; name = Debug; }; @@ -3879,7 +3890,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", + "$(inherited)", ); GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_MODEL_TUNING = G5; @@ -3892,13 +3903,9 @@ "-framework", Cocoa, "-framework", - SenTestingKit, - "-framework", OCMock, ); PRODUCT_NAME = "Unit Tests"; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; }; name = Release; }; @@ -3909,7 +3916,7 @@ COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", + "$(inherited)", ); GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_MODEL_TUNING = G5; @@ -3922,13 +3929,9 @@ "-framework", Foundation, "-framework", - SenTestingKit, - "-framework", OCMock, ); PRODUCT_NAME = "Unit Tests"; - TEST_AFTER_BUILD = YES; - WRAPPER_EXTENSION = octest; }; name = Distribution; }; diff --git a/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro (10.6 SDK).xcscheme b/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro (10.6 SDK).xcscheme index e6b89ad7..00d9dc14 100644 --- a/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro (10.6 SDK).xcscheme +++ b/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro (10.6 SDK).xcscheme @@ -33,7 +33,7 @@ <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "380F4ED80FC0B50500B0BFD7" - BuildableName = "Unit Tests.octest" + BuildableName = "Unit Tests.xctest" BlueprintName = "Unit Tests" ReferencedContainer = "container:sequel-pro.xcodeproj"> </BuildableReference> @@ -48,6 +48,8 @@ ReferencedContainer = "container:sequel-pro.xcodeproj"> </BuildableReference> </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> </TestAction> <LaunchAction selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" @@ -57,8 +59,10 @@ buildConfiguration = "Debug" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" + debugServiceExtension = "internal" allowLocationSimulation = "YES"> - <BuildableProductRunnable> + <BuildableProductRunnable + runnableDebuggingMode = "0"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "8D15AC270486D014006FF6A4" @@ -76,7 +80,8 @@ useCustomWorkingDirectory = "NO" buildConfiguration = "Release" debugDocumentVersioning = "YES"> - <BuildableProductRunnable> + <BuildableProductRunnable + runnableDebuggingMode = "0"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "8D15AC270486D014006FF6A4" diff --git a/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro Release Build (10.6+).xcscheme b/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro Release Build (10.6+).xcscheme index a3785caa..2492f320 100644 --- a/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro Release Build (10.6+).xcscheme +++ b/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro Release Build (10.6+).xcscheme @@ -42,7 +42,7 @@ <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "380F4ED80FC0B50500B0BFD7" - BuildableName = "Unit Tests.octest" + BuildableName = "Unit Tests.xctest" BlueprintName = "Unit Tests" ReferencedContainer = "container:sequel-pro.xcodeproj"> </BuildableReference> @@ -57,6 +57,8 @@ ReferencedContainer = "container:sequel-pro.xcodeproj"> </BuildableReference> </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> </TestAction> <LaunchAction selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" @@ -66,6 +68,7 @@ buildConfiguration = "Distribution" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" + debugServiceExtension = "internal" allowLocationSimulation = "YES"> <BuildableProductRunnable runnableDebuggingMode = "0"> diff --git a/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro.xcscheme b/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro.xcscheme index 579336f6..34c76c45 100644 --- a/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro.xcscheme +++ b/sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro.xcscheme @@ -33,7 +33,7 @@ <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "380F4ED80FC0B50500B0BFD7" - BuildableName = "Unit Tests.octest" + BuildableName = "Unit Tests.xctest" BlueprintName = "Unit Tests" ReferencedContainer = "container:sequel-pro.xcodeproj"> </BuildableReference> @@ -55,6 +55,8 @@ isEnabled = "YES"> </EnvironmentVariable> </EnvironmentVariables> + <AdditionalOptions> + </AdditionalOptions> </TestAction> <LaunchAction selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" @@ -64,8 +66,10 @@ buildConfiguration = "Debug" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" + debugServiceExtension = "internal" allowLocationSimulation = "YES"> - <BuildableProductRunnable> + <BuildableProductRunnable + runnableDebuggingMode = "0"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "8D15AC270486D014006FF6A4" @@ -83,7 +87,8 @@ useCustomWorkingDirectory = "NO" buildConfiguration = "Release" debugDocumentVersioning = "YES"> - <BuildableProductRunnable> + <BuildableProductRunnable + runnableDebuggingMode = "0"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "8D15AC270486D014006FF6A4" |