importing unit tests

This commit is contained in:
John Rommel Estropia
2016-06-12 20:34:13 +09:00
parent 8e5c7ec9b2
commit 76a2bc1da2
15 changed files with 1603 additions and 404 deletions

View File

@@ -70,7 +70,7 @@ class BaseTestCase: XCTestCase {
CoreStore.logger = TestLogger(self.prepareLoggerExpectations(expectations))
defer {
self.waitForExpectationsWithTimeout(0, handler: nil)
self.checkExpectationsImmediately()
CoreStore.logger = TestLogger([:])
}
return closure()
@@ -93,6 +93,17 @@ class BaseTestCase: XCTestCase {
return testExpectations
}
@nonobjc
func checkExpectationsImmediately() {
self.waitForExpectationsWithTimeout(0, handler: nil)
}
@nonobjc
func waitAndCheckExpectations() {
self.waitForExpectationsWithTimeout(10, handler: nil)
}
// MARK: XCTestCase
@@ -165,10 +176,9 @@ class TestLogger: CoreStoreLogger {
self.fulfill(.AssertionFailure)
}
@noreturn func fatalError(message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
func abort(message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
self.fulfill(.FatalError)
Swift.fatalError()
}