Skip to content

Commit 465d023

Browse files
committed
Nest subtopics of article correctly, note platform availability
1 parent b8265c7 commit 465d023

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Sources/Testing/Testing.docc/OrganizingTests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct MenuTests {
124124
The compiler emits an error when presented with a test suite that doesn't
125125
meet this requirement.
126126

127-
### Test suite types must always be available
127+
#### Test suite types must always be available
128128

129129
Although `@available` can be applied to a test function to limit its
130130
availability at runtime, a test suite type (and any types that contain it) must

Sources/Testing/Testing.docc/exit-testing.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ See https://swift.org/LICENSE.txt for license information
1010
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
1111
-->
1212

13+
@Metadata {
14+
@Available(macOS, introduced: 10.15)
15+
@Available(Swift, introduced: 6.2)
16+
}
17+
1318
Use exit tests to test functionality that may cause a test process to exit.
1419

1520
## Overview
@@ -33,7 +38,9 @@ precondition will fail and Swift will force the process to exit. You can write
3338
an exit test to validate preconditions like the ones above and to make sure that
3439
your functions correctly catch invalid inputs.
3540

36-
## Create an exit test
41+
- Note: Exit tests are available on macOS, Linux, FreeBSD, OpenBSD, and Windows.
42+
43+
### Create an exit test
3744

3845
To create an exit test, call either the ``expect(exitsWith:observing:_:sourceLocation:performing:)``
3946
or the ``require(exitsWith:observing:_:sourceLocation:performing:)`` macro:
@@ -63,7 +70,7 @@ If the body returns before the child process exits, it is allowed to return and
6370
the process exits naturally. If an error is thrown from the body, it is handled
6471
as if the error were thrown from `main()` and the process is forced to exit.
6572

66-
## Specify an exit condition
73+
### Specify an exit condition
6774

6875
When you create an exit test, you must specify how you expect the child process
6976
will exit by passing an instance of ``ExitTest/Condition``:
@@ -82,7 +89,7 @@ status of the child process against the expected exit condition you passed. If
8289
they match, the exit test has passed; otherwise, it has failed and the testing
8390
library records an issue.
8491

85-
## Gather output from the child process
92+
### Gather output from the child process
8693

8794
By default, the child process is configured without a standard output or
8895
standard error stream. If your test needs to review the content of either of
@@ -123,9 +130,9 @@ extension Customer {
123130
The actual exit condition of the child process is always reported by the testing
124131
library even if you do not specify it in `observedValues`.
125132

126-
## Constraints on exit tests
133+
### Constraints on exit tests
127134

128-
### State cannot be captured
135+
#### State cannot be captured
129136

130137
Exit tests cannot capture any state originating in the parent process or from
131138
the enclosing lexical context. For example, the following exit test will fail to
@@ -142,6 +149,6 @@ compile because it captures a variable declared outside the exit test itself:
142149
}
143150
```
144151

145-
### Exit tests cannot be nested
152+
#### Exit tests cannot be nested
146153

147154
An exit test cannot run within another exit test.

0 commit comments

Comments
 (0)