Skip to content

Commit 23be01b

Browse files
committed
Some minor editing.
1 parent 81328fd commit 23be01b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Docs/Testing.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ swift-corelibs-foundation uses XCTest for its own test suite. This document expl
66

77
### In brief
88

9-
* Tests should fail rather than crashing; swift-corelibs-xctest does not implement any crash recovery.
10-
* You should avoid forced optional unwrapping (e.g.: `aValue!`). Use `try aValue.unwrapped()` instead.
11-
* You can test code that is expected to crash. You must mark the whole body of the test method with `assertCrashes(within:)`.
12-
* If a test or a portion of a test is giving the build trouble, use `testExpectedToFail` and write a bug.
9+
* Tests should fail rather than crashing; swift-corelibs-xctest does not implement any crash recovery
10+
* You should avoid forced optional unwrapping (e.g.: `aValue!`). Use `try aValue.unwrapped()` instead
11+
* You can test code that is expected to crash; you must mark the whole body of the test method with `assertCrashes(within:)`
12+
* If a test or a portion of a test is giving the build trouble, use `testExpectedToFail` and write a bug
1313

1414
### Why and How
1515

@@ -47,7 +47,7 @@ func testSomeInterestingAPI() throws { // Step 1: Add 'throws'
4747
}
4848
```
4949

50-
### Asserting That Code Crashes
50+
#### Asserting That Code Crashes
5151

5252
Some API, like `NSCoder`'s `raiseException` failure policy, are _supposed_ to crash the process when faced with edge conditions. Since tests should fail and not crash, we have been unable to test this behavior for the longest time.
5353

@@ -68,7 +68,7 @@ func testRandomClassDoesNotDeserialize() {
6868

6969
Since the closure will only execute to the first crash, ensure you do not use multiple `assertCrashes…` markers in the same test method, that you do _not_ mix crash tests with regular test code, and that if you want to test multiple crashes you do so with separate test methods. Wrapping the entire method body is an easy way to ensure that at least some of these objectives are met.
7070

71-
### Stopping Flaky or Crashing Tests
71+
#### Stopping Flaky or Crashing Tests
7272

7373
A test that crashes or fails multiple times can jeopardize patch testing and regression reporting. If a test is flaky or outright failing or crashing, it should be marked as expected to fail ASAP using the appropriate Foundation test utilities.
7474

0 commit comments

Comments
 (0)