Skip to content

Commit b46b3f3

Browse files
medreisbachchuckdudegrynspan
authored
Updates to conform documentation to API collection style guidelines (#343)
Updates to conform to API collection style guidelines: - Begin titles with a noun. - Place everything under topic groups. - Begin topic group headings with a gerund. - Add symbols alongside articles in the topic groups. Curation changes: - Move expected throws content up into expectations and split known issues into its own collection. Part 2 of changes for rdar://119702877 ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated. --------- Co-authored-by: Chuck Toporek <[email protected]> Co-authored-by: Jonathan Grynspan <[email protected]>
1 parent 74a0cbd commit b46b3f3

File tree

6 files changed

+104
-73
lines changed

6 files changed

+104
-73
lines changed

Sources/Testing/Testing.docc/Documentation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!--
66
This source file is part of the Swift.org open source project
77
8-
Copyright (c) 2023 Apple Inc. and the Swift project authors
8+
Copyright (c) 2023–2024 Apple Inc. and the Swift project authors
99
Licensed under Apache License v2.0 with Runtime Library Exception
1010
1111
See https://swift.org/LICENSE.txt for license information
@@ -60,6 +60,7 @@ concurrency, and parameterize test functions across wide ranges of inputs.
6060
### Behavior validation
6161

6262
- <doc:Expectations>
63+
- <doc:known-issues>
6364

6465
### Test customization
6566

Sources/Testing/Testing.docc/ExpectThrows.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

Sources/Testing/Testing.docc/Expectations.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Validating behavior using expectations
1+
# Expectations and confirmations
22

33
<!--
44
This source file is part of the Swift.org open source project
55
6-
Copyright (c) 2023 Apple Inc. and the Swift project authors
6+
Copyright (c) 2023–2024 Apple Inc. and the Swift project authors
77
Licensed under Apache License v2.0 with Runtime Library Exception
88
99
See https://swift.org/LICENSE.txt for license information
@@ -14,25 +14,35 @@ Check for expected values and outcomes in tests.
1414

1515
## Overview
1616

17-
Tests may validate behaviors using expectations. This page describes the various
18-
built-in expectation APIs.
17+
The testing library provides `#expect()` and `#require()` macros you use to
18+
validate expected outcomes. To validate that an error is thrown, or _not_ thrown,
19+
the testing library provides several overloads of the macros that you can use.
20+
Use a ``Confirmation`` to confirm the occurrence of an asynchronous event that
21+
you can't check directly using an expectation.
1922

2023
## Topics
2124

22-
### Validating behavior using expectations
25+
### Checking expectations
2326

2427
- ``expect(_:_:sourceLocation:)``
2528
- ``require(_:_:sourceLocation:)-5l63q``
2629
- ``require(_:_:sourceLocation:)-6w9oo``
2730

28-
### Validating asynchronous behavior using confirmations
31+
### Checking that errors are thrown
2932

30-
- ``Confirmation``
31-
- ``confirmation(_:expectedCount:fileID:filePath:line:column:_:)``
33+
- ``expect(throws:_:sourceLocation:performing:)-79piu``
34+
- ``expect(throws:_:sourceLocation:performing:)-1xr34``
35+
- ``expect(_:sourceLocation:performing:throws:)``
36+
- ``expect(throws:_:sourceLocation:performing:)-5lzjz``
37+
- ``require(throws:_:sourceLocation:performing:)-76bjn``
38+
- ``require(throws:_:sourceLocation:performing:)-7v83e``
39+
- ``require(_:sourceLocation:performing:throws:)``
40+
- ``require(throws:_:sourceLocation:performing:)-36uzc``
3241

33-
### Validating errors and issues in tests
42+
### Confirming that asynchronous events occur
3443

35-
- <doc:ExpectThrows>
44+
- ``confirmation(_:expectedCount:fileID:filePath:line:column:_:)``
45+
- ``Confirmation``
3646

3747
### Retrieving information about checked expectations
3848

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Adding traits to tests
1+
# Traits
22

33
<!--
44
This source file is part of the Swift.org open source project
55
6-
Copyright (c) 2023 Apple Inc. and the Swift project authors
6+
Copyright (c) 2023–2024 Apple Inc. and the Swift project authors
77
Licensed under Apache License v2.0 with Runtime Library Exception
88
99
See https://swift.org/LICENSE.txt for license information
@@ -14,24 +14,52 @@ Add traits to tests to annotate them or customize their behavior.
1414

1515
## Overview
1616

17-
This article describes the ``Trait``, ``TestTrait``, and ``SuiteTrait``
18-
protocols, lists the traits provided by the testing library, and lists functions
19-
that can be used to create them.
20-
21-
The ``Trait``, ``TestTrait``, and ``SuiteTrait`` protocols are used to define
22-
types that customize the behavior of test functions and test suites.
17+
Pass built-in traits to test functions or suite types to comment, categorize,
18+
classify, and modify runtime behaviors. You can also use the ``Trait``, ``TestTrait``,
19+
and ``SuiteTrait`` protocols to create your own types that customize the
20+
behavior of test functions.
2321

2422
## Topics
2523

24+
### Customizing runtime behaviors
25+
2626
- <doc:EnablingAndDisabling>
27+
- <doc:LimitingExecutionTime>
28+
- <doc:Parallelization>
29+
- ``Trait/enabled(if:_:fileID:filePath:line:column:)``
30+
- ``Trait/enabled(_:fileID:filePath:line:column:_:)``
31+
- ``Trait/disabled(_:fileID:filePath:line:column:)``
32+
- ``Trait/disabled(if:_:fileID:filePath:line:column:)``
33+
- ``Trait/disabled(_:fileID:filePath:line:column:_:)``
34+
- ``Trait/timeLimit(_:)``
35+
36+
<!--
37+
HIDDEN: .serial is experimental SPI pending feature review.
38+
### Running tests serially or in parallel
39+
- ``SerialTrait``
40+
-->
41+
42+
### Annotating tests
43+
2744
- <doc:AddingTags>
2845
- <doc:AddingComments>
2946
- <doc:AssociatingBugs>
30-
- <doc:LimitingExecutionTime>
31-
- <doc:Parallelization>
47+
- <doc:BugIdentifiers>
48+
- ``Tag()``
49+
- ``Trait/bug(_:relationship:_:)-86mmm``
50+
- ``Trait/bug(_:relationship:_:)-3hsi5``
3251

33-
### Creating a custom trait
52+
### Creating custom traits
3453

3554
- ``Trait``
3655
- ``TestTrait``
3756
- ``SuiteTrait``
57+
58+
### Supporting types
59+
60+
- ``Bug``
61+
- ``Comment``
62+
- ``ConditionTrait``
63+
- ``Tag``
64+
- ``Tag/List``
65+
- ``TimeLimitTrait``

Sources/Testing/Testing.docc/Traits/Trait.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# ``Trait``
22

3+
<!--
4+
This source file is part of the Swift.org open source project
5+
6+
Copyright (c) 2024 Apple Inc. and the Swift project authors
7+
Licensed under Apache License v2.0 with Runtime Library Exception
8+
9+
See https://swift.org/LICENSE.txt for license information
10+
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
11+
-->
12+
313
## Topics
414

515
### Enabling and disabling tests
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Known issues
2+
3+
<!--
4+
This source file is part of the Swift.org open source project
5+
6+
Copyright © 2023–2024 Apple Inc. and the Swift project authors
7+
Licensed under Apache License v2.0 with Runtime Library Exception
8+
9+
See https://swift.org/LICENSE.txt for license information
10+
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
11+
-->
12+
13+
Highlight known issues when running tests.
14+
15+
## Overview
16+
17+
The testing library provides a function, `withKnownIssue()`, that you
18+
use to mark issues as known. Use this function to inform the testing library
19+
at runtime not to mark the test as failing when issues occur.
20+
21+
## Topics
22+
23+
### Recording known issues in tests
24+
25+
- ``withKnownIssue(_:isIntermittent:fileID:filePath:line:column:_:)-5pxnd``
26+
- ``withKnownIssue(_:isIntermittent:fileID:filePath:line:column:_:)-30kgk``
27+
- ``withKnownIssue(_:isIntermittent:fileID:filePath:line:column:_:when:matching:)-68e5g``
28+
- ``withKnownIssue(_:isIntermittent:fileID:filePath:line:column:_:when:matching:)-7azqg``
29+
- ``KnownIssueMatcher``
30+
31+
### Describing a failure or warning
32+
33+
- ``Issue``

0 commit comments

Comments
 (0)