SwiftAsyncAssert

1.0.1

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

What's New

1.0.1

2023-08-15T10:49:13Z
  • Fixed AsyncAssertThrowsError(::_:) would not execute the error handler closure in case the evaluated expression throws an error.

Full Changelog: https://github.com/angu-software/SwiftAsyncAssert/CHANGELOG.md

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 Oct 20 2024 02:44:59 GMT-0900 (Hawaii-Aleutian Daylight Time)