Permalink
Browse files

Merge pull request #2425 from bamse16/master

Converted tests to XCTest
  • Loading branch information...
abhibeckert committed Mar 4, 2016
2 parents 0ac1ebf + cbbd6e0 commit 49cc4d168902782b7be123dbefc8426ec11be2e2
Showing with 425 additions and 254 deletions.
  1. +24 −20 Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj
  2. +14 −2 Frameworks/PostgresKit/PostgresKit.xcodeproj/xcshareddata/xcschemes/PostgresKit.xcscheme
  3. +1 −1 Frameworks/PostgresKit/Resources/Info.plist
  4. +1 −1 Frameworks/PostgresKit/Resources/Tests-Info.plist
  5. +1 −1 Frameworks/PostgresKit/Tests/PGDataTypeTests.h
  6. +6 −6 Frameworks/PostgresKit/Tests/PGDataTypeTests.m
  7. +2 −2 Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.h
  8. +15 −1 Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m
  9. +1 −1 Frameworks/PostgresKit/Tests/PGPostgresResultTests.h
  10. +2 −2 Frameworks/PostgresKit/Tests/PGPostgresResultTests.m
  11. +27 −23 Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj
  12. +14 −2 Frameworks/QueryKit/QueryKit.xcodeproj/xcshareddata/xcschemes/QueryKit.xcscheme
  13. +1 −1 Frameworks/QueryKit/Resources/Info.plist
  14. +1 −1 Frameworks/QueryKit/Resources/Tests-Info.plist
  15. +2 −2 Frameworks/QueryKit/Tests/QKDeleteQueryTests.h
  16. +8 −8 Frameworks/QueryKit/Tests/QKDeleteQueryTests.m
  17. +12 −12 Frameworks/QueryKit/Tests/QKQueryTests.m
  18. +2 −2 Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.h
  19. +6 −6 Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m
  20. +2 −2 Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.h
  21. +8 −8 Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m
  22. +2 −2 Frameworks/QueryKit/Tests/QKSelectQueryTests.h
  23. +8 −8 Frameworks/QueryKit/Tests/QKSelectQueryTests.m
  24. +2 −2 Frameworks/QueryKit/Tests/QKTestCase.h
  25. +2 −2 Frameworks/QueryKit/Tests/QKUpdateQueryTests.h
  26. +7 −7 Frameworks/QueryKit/Tests/QKUpdateQueryTests.m
  27. +1 −1 Frameworks/SPMySQLFramework/Resources/Info.plist
  28. +1 −1 Frameworks/SPMySQLFramework/SPMySQL Unit Tests/Info.plist
  29. +10 −1 Frameworks/SPMySQLFramework/SPMySQLFramework.xcodeproj/project.pbxproj
  30. +99 −0 ...rks/SPMySQLFramework/SPMySQLFramework.xcodeproj/xcshareddata/xcschemes/SPMySQL.framework.xcscheme
  31. +3 −3 Source/SPComboPopupButton.m
  32. +35 −35 UnitTests/SPDataAdditionsTests.m
  33. +5 −5 UnitTests/SPDatabaseActionTest.m
  34. +3 −3 UnitTests/SPMenuAdditionsTests.m
  35. +3 −3 UnitTests/SPMutableArrayAdditionsTests.m
  36. +11 −11 UnitTests/SPParserUtilsTest.m
  37. +32 −32 UnitTests/SPStringAdditionsTests.m
  38. +4 −3 UnitTests/SPTableCopyTest.m
  39. +5 −5 UnitTests/SPTableFilterParserTest.m
  40. +22 −19 sequel-pro.xcodeproj/project.pbxproj
  41. +8 −3 sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro (10.6 SDK).xcscheme
  42. +4 −1 sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro Release Build (10.6+).xcscheme
  43. +8 −3 sequel-pro.xcodeproj/xcshareddata/xcschemes/Sequel Pro.xcscheme
@@ -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;
@@ -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>
@@ -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>
@@ -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>
@@ -27,7 +27,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#import <PostgresKit/PostgresKit.h>
#import <SenTestingKit/SenTestingKit.h>
#import <XCTest/XCTest.h>
#import "PGPostgresIntegrationTestCase.h"
@@ -33,7 +33,7 @@ @interface PGDataTypeTests ()
+ (void)_addTestForField:(NSString *)field
withExpectedResult:(id)result
connection:(PGPostgresConnection *)connection
toTestSuite:(SenTestSuite *)testSuite;
toTestSuite:(XCTestSuite *)testSuite;
@end
@@ -48,7 +48,7 @@ @implementation PGDataTypeTests
+ (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)setUp
- (void)testResultValueIsNotNil
{
STAssertNotNil(_result, nil);
XCTAssertNotNil(_result);
}
- (void)testResultIsOfCorrectTypeAndValue
{
STAssertEqualObjects(_result, _expectedResult, nil);
XCTAssertEqualObjects(_result, _expectedResult);
}
#pragma mark -
@@ -123,11 +123,11 @@ - (void)testResultIsOfCorrectTypeAndValue
+ (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];
@@ -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;
}
@@ -35,6 +35,8 @@
static NSUInteger PGTestDatabasePort = 5432;
static double PGTestConnectionTimeout = 0.2;
@interface PGPostgresIntegrationTestCase ()
- (void)_establishConnection;
@@ -67,13 +69,25 @@ - (void)_establishConnection
[_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]);
}
@@ -27,7 +27,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#import <PostgresKit/PostgresKit.h>
#import <SenTestingKit/SenTestingKit.h>
#import <XCTest/XCTest.h>
#import "PGPostgresIntegrationTestCase.h"
@@ -63,7 +63,7 @@ - (void)testResultDescriptionIsCorrect
"}");
// 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 @@ - (void)testResultDescriptionIsCorrect
"\"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 -
Oops, something went wrong.

0 comments on commit 49cc4d1

Please sign in to comment.