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
XCTRuntimeAssertions
to your system under test and call theassert
andprecondition
functions that are defined in theXCTRuntimeAssertions
Swift package. They provide the same functionality and parameters as theassert
andprecondition
functions in the Swift Standard Library.Use the
XCTRuntimeAssertion
andXCTRuntimePrecondition
global functions to write unit tests that expect anassert
andprecondition
and use the additional parameters to further refine and specify your assertions:XCTRuntimeAssertion
for catching assertions:XCTRuntimePrecondition
for 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.