SwiftAsyncAssert

1.1.0

Assert functions to evaluate Swift concurrency async expressions in XCTests.
angu-software/SwiftAsyncAssert

What's New

1.1.0

2024-12-30T11:36:09Z

1.1.0

  • Ensure compatibility with Swift 6.0
  • Account for possible data races when evaluating expressions in case they throwing an error to be

SwiftAsyncAssert

version build status

Assert functions to evaluate Swift concurrency async expressions in XCTests.

The Missing concurrency functions in XCTest framework


Instead of writing

import XCTest

func test_should_succeed() async {
    do {
        let isTrue = try await shouldSucceed()
        XCTAssertTrue(isTrue)
    } catch {
        XCFail("Should not throw an error")
    }
}

conveniently write

import SwiftAsyncAssert

func test_should_succeed() async {
    await AsyncAssertTrue(try await shouldSucceed())
}

func test_should_throwError() async {
    await AsyncAssertThrowsError(try await shouldFail())
}

Less code for your convenience when testing!

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Apr 27 2025 13:13:59 GMT-0900 (Hawaii-Aleutian Daylight Time)