aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/PostgresKit/Tests')
-rw-r--r--Frameworks/PostgresKit/Tests/PGDataTypeTests.h2
-rw-r--r--Frameworks/PostgresKit/Tests/PGDataTypeTests.m12
-rw-r--r--Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.h4
-rw-r--r--Frameworks/PostgresKit/Tests/PGPostgresIntegrationTestCase.m16
-rw-r--r--Frameworks/PostgresKit/Tests/PGPostgresResultTests.h2
-rw-r--r--Frameworks/PostgresKit/Tests/PGPostgresResultTests.m4
6 files changed, 27 insertions, 13 deletions
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 -