From 3ea02d6aaa5e325650492ac7012e913344141128 Mon Sep 17 00:00:00 2001 From: Majid Jabrayilov Date: Sat, 26 Oct 2024 22:04:18 +0400 Subject: [PATCH] swift basics custom display name section tuned --- _posts/2024-10-22-introducing-swift-testing-basics.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/_posts/2024-10-22-introducing-swift-testing-basics.md b/_posts/2024-10-22-introducing-swift-testing-basics.md index b9d59e3..4bcdda5 100644 --- a/_posts/2024-10-22-introducing-swift-testing-basics.md +++ b/_posts/2024-10-22-introducing-swift-testing-basics.md @@ -24,9 +24,7 @@ func add(_ a: Int, _ b: Int) -> Int { } ``` -As you can see in the example above, we use the *@Test* macro to annotate our *verifyAdd* function. You don't need to name your test functions with any prefix; you only need to annotate tests with the *@Test* macro. - -You can annotate the functions with *@Test* macro throwing and async. Throwing tests will fail whenever an unhandled error appears. Async test cases allows us to await values and verify the outcomes using the Swift Concurrency feature. You can also use them side-by-side with XCTest classes in a single project. +As you can see in the example above, we use the *@Test* macro to annotate our *verifyAdd* function. You don't need to name your test functions with any prefix; you only need to annotate tests with the *@Test* macro. We can also customize the display name to show a different title in the Test navigator. ```swift @Test("Verify addition function") func verifyAdd() { @@ -35,7 +33,7 @@ You can annotate the functions with *@Test* macro throwing and async. Throwing t } ``` -We can also customize the display name to show a different title in the Test navigator. +You can annotate the functions with *@Test* macro throwing and async. Throwing tests will fail whenever an unhandled error appears. Async test cases allows us to await values and verify the outcomes using the Swift Concurrency feature. You can also use them side-by-side with XCTest classes in a single project. The *expect* macro allows you to assert the values in your tests. It replaces the whole collection of the assert functions from the XCTest framework with a single one. You place the boolean expression inside the *expect* macro, which will pass whenever it is true and fail whenever it is false.