XCTRuntimeAssertions allows developers to test assertions and preconditions in tests using XCTest.
How To Use XCTRuntimeAssertions
You can use XCTestExtensions in your tests. The API documentation provides a detailed overview of the public interface of XCTestExtensions.
Import XCTRuntimeAssertions to your system under test and call the assert and precondition functions that are defined in the XCTRuntimeAssertions Swift package. They provide the same functionality and parameters as the assert and precondition functions in the Swift Standard Library.
Use the XCTRuntimeAssertion and XCTRuntimePrecondition global functions to write unit tests that expect an assert and precondition and use the additional parameters to further refine and specify your assertions:
XCTRuntimeAssertion for catching assertions:
try XCTRuntimeAssertion {
assertionFailure()
}
XCTRuntimePrecondition for catching preconditions:
XCTRuntimeAssertions
XCTRuntimeAssertions allows developers to test assertions and preconditions in tests using XCTest.
How To Use XCTRuntimeAssertions
You can use XCTestExtensions in your tests. The API documentation provides a detailed overview of the public interface of XCTestExtensions.
Import
XCTRuntimeAssertionsto your system under test and call theassertandpreconditionfunctions that are defined in theXCTRuntimeAssertionsSwift package. They provide the same functionality and parameters as theassertandpreconditionfunctions in the Swift Standard Library.Use the
XCTRuntimeAssertionandXCTRuntimePreconditionglobal functions to write unit tests that expect anassertandpreconditionand use the additional parameters to further refine and specify your assertions:XCTRuntimeAssertionfor catching assertions:XCTRuntimePreconditionfor catching preconditions:For more information, please refer to the API documentation.
Contributing
Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.
License
This project is licensed under the MIT License. See Licenses for more information.