Open
Description
Hello,
I'm trying to use XCTAssertNoThrow
method with async function. I'm trying to use it as this:
XCTAssertNoThrow {
let item = try await map.getItem(with: "āž$*")
XCTAssertNil(item)
}
It turns out the callback is never run. In my case try
returns with an error, which is thrown from getItem
.
I ended up with this solution, which is suboptimal:
var caughtError: Error?
do {
let item = try await map.getItem(with: "āž$*")
XCTAssertNil(item)
} catch {
caughtError = error
}
XCTExpectFailure("test fails for the time being") {
XCTAssertNil(caughtError)
}
Side note: XCTExpectFailure
doesn't run the async closure as well.