Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XCTAssertNoThrowAsync and XCTAssertThrowsErrorAsync #485

Closed
wants to merge 2 commits into from

Conversation

jiyimeta
Copy link

@jiyimeta jiyimeta commented Apr 17, 2024

Add XCTAssertNoThrowAsync and XCTAssertThrowsErrorAsync, which are the async versions of XCTAssertNoThrow and XCTAssertThrowsError.

I adopted different names from sync ones in order to avoid confusion of overloads.
For example, if the sync and async versions have the same name XCTAssertThrowsError,

func testExample() async {
    XCTAssertThrowsError(try functionThatDoesThrowError())
}

such a sync assertion in an async context will cause compile error with message Expression is 'async' but is not marked with 'await', despite success before this change.

Resolves #419.

@briancroom
Copy link
Collaborator

Hi @jiyimeta, thanks for your interest in improving XCTest. Unfortunately we aren't accepting new APIs here on the swift-corelibs-xctest repository, because its primary purpose is to provide a compatible implementation of the APIs provided by the XCTest that ships with Xcode, for use when targeting platforms that Xcode doesn't support.

I recommend that you keep these additional APIs in your own project/package, and file an Xcode enhancement request at http://bugreport.apple.com.

@briancroom briancroom closed this Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support async calls with XCTAssertNoThrow, XCTAssertThrowsError, XCTExpectFailure...
3 participants