I have a project in which I created a dynamic structure. Inside the structure itself, and not as part of the framework tests, I have the following file:
import Foundation import XCTest public func assertThrowsException(function: () throws -> Void) { XCTAssertTrue(doesItThrowException(function)) } public func assertDoesNotThrowsException(function: () throws -> Void) { XCTAssertFalse(doesItThrowException(function)) } private func doesItThrowException(function: () throws -> Void) -> Bool { do { let _ = try function() } catch { return true } return false }
These are utilities to claim that clojure throws an exception. This compensates for the missing Swift XCTAssertThrows ().
Of course, I need to import the XCTest framework in order to use the XCTAssert * methods. But I canβt achieve this. I get an error all the time that a framework with this name is not available.
Do you know how to import XCTest successfully?
Thank you very much
source share