作者:我爱你800916 | 来源:互联网 | 2023-05-16 05:37
IhaveaprojectwhereIhavecreatedadynamicframework.Insidetheframeworkitself,notthefram
I have a project where I have created a dynamic framework. Inside the framework itself, not the framework's 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
}
They are utility methods to assert that a clojure is raising an exception. It's to make up for the missing Swift's XCTAssertThrows().
它们是用于断言clojure引发异常的实用方法。这是为了弥补失踪的Swift的XCTAssertThrows()。
Of course I have to import the XCTest framework to be able to use XCTAssert* methods. But I am not able to achieve it. I keep receiving an error that a framework with that name is not available.
当然,我必须导入XCTest框架才能使用XCTAssert *方法。但我无法实现它。我一直收到一个错误,即该名称的框架不可用。
Do you have any idea how to successfully import XCTest?
你知道如何成功导入XCTest吗?
Thank you very much
非常感谢你
1 个解决方案