Skip to content

Commit 9c31ad5

Browse files
chuckdudeChuck Toporekgrynspanmedreisbach
authored
Proofread pass of the articles (#393)
Made a proofreading pass through the articles. ### Motivation: To verify there are no typos. ### Modifications: Largely, made edits to correct tense and turn text like "it is" or "does not" into contractions ("it's" and "doesn't", respectively). ### Result: Clean up pass for initial release. ### 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]> Co-authored-by: dreisbach <[email protected]>
1 parent d5f9851 commit 9c31ad5

10 files changed

+143
-148
lines changed

Sources/Testing/Testing.docc/AddingComments.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ Add comments to provide useful information about tests.
1414

1515
## Overview
1616

17-
It is often useful to add comments to code in order:
17+
It's often useful to add comments to code to:
1818

19-
- to provide context or background information about the code's purpose;
20-
- to explain how complex code implemented; or
21-
- to include details which may be helpful when diagnosing issues.
19+
- Provide context or background information about the code's purpose
20+
- Explain how complex code implemented
21+
- Include details which may be helpful when diagnosing issues
2222

2323
Test code is no different and can benefit from explanatory code comments, but
2424
often test issues are shown in places where the source code of the test is
@@ -44,7 +44,7 @@ immediately before its `@Test` or `@Suite` attribute:
4444
}
4545
```
4646

47-
The comment `"// Assumes the standard lunch menu includes a taco"` will be added
47+
The comment, `// Assumes the standard lunch menu includes a taco`, is added
4848
to the test.
4949

5050
The following language comment styles are supported:
@@ -61,7 +61,7 @@ The following language comment styles are supported:
6161
Test comments which are automatically added from source code comments preserve
6262
their original formatting, including any prefixes like `//` or `/**`. This
6363
is because the whitespace and formatting of comments can be meaningful in some
64-
circumstances or aid in understanding the commentfor example, when a comment
64+
circumstances or aid in understanding the commentfor example, when a comment
6565
includes an example code snippet or diagram.
6666

6767
<!-- FIXME: Uncomment this section if/when the `.comment(...)` trait is promoted
@@ -88,10 +88,10 @@ func lunchMenu() {
8888

8989
## Use test comments effectively
9090

91-
As in normal code, comments on tests are generally most useful when:
91+
As in normal code, comments on tests are generally most useful when they:
9292

93-
- they add information that isn't obvious from reading the code; or
94-
- they provide useful information about the operation or motivation of a test.
93+
- Add information that isn't obvious from reading the code
94+
- Provide useful information about the operation or motivation of a test
9595

9696
If a test is related to a bug or issue, consider using the ``Bug`` trait instead
97-
of comments. For more information, review <doc:AssociatingBugs>.
97+
of comments. For more information, see <doc:AssociatingBugs>.

Sources/Testing/Testing.docc/AddingTags.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Use tags to provide semantic information for organization, filtering, and custom
1616

1717
A complex package or project may contain hundreds or thousands of tests and
1818
suites. Some subset of those tests may share some common facet, such as being
19-
"critical" or "flaky". The testing library includes a type of trait called
20-
"tags" that can be added to tests to group and categorize them.
19+
_critical_ or _flaky_. The testing library includes a type of trait called
20+
_tags_ that you can add to group and categorize tests.
2121

2222
Tags are different from test suites: test suites impose structure on test
2323
functions at the source level, while tags provide semantic information for a
@@ -31,7 +31,7 @@ a sequence of tags as its argument, and those tags are then applied to the
3131
corresponding test at runtime. If any tags are applied to a test suite, then all
3232
tests in that suite inherit those tags.
3333

34-
The testing library does not assign any semantic meaning to any tags, nor does
34+
The testing library doesn't assign any semantic meaning to any tags, nor does
3535
the presence or absence of tags affect how the testing library runs tests.
3636

3737
Tags themselves are instances of ``Tag`` and can be expressed as string
@@ -52,7 +52,7 @@ If two tags with the same name (`legallyRequired` in the above example) are
5252
declared in different files, modules, or other contexts, the testing library
5353
treats them as equivalent.
5454

55-
If it is important for a tag to be distinguished from similar tags declared
55+
If it's important for a tag to be distinguished from similar tags declared
5656
elsewhere in a package or project (or its dependencies), use
5757
[reverse-DNS naming](https://en.wikipedia.org/wiki/Reverse_domain_name_notation)
5858
to create a unique Swift symbol name for your tag:
@@ -82,10 +82,10 @@ The following example is unsupported:
8282

8383
```swift
8484
extension Tag {
85-
@Tag static var legallyRequired: Self // ✅ OK: declaring a new tag
85+
@Tag static var legallyRequired: Self // ✅ OK: Declaring a new tag.
8686

87-
static var requiredByLaw: Self { // ❌ ERROR: this tag name will not be
88-
// recognized at runtime
87+
static var requiredByLaw: Self { // ❌ ERROR: This tag name isn't
88+
// recognized at runtime.
8989
legallyRequired
9090
}
9191
}
@@ -97,11 +97,11 @@ declaration), it cannot be applied to test functions or test suites. The
9797
following declarations are unsupported:
9898

9999
```swift
100-
@Tag let needsKetchup: Self // ❌ ERROR: tags must be declared in an extension
101-
// to Tag
100+
@Tag let needsKetchup: Self // ❌ ERROR: Tags must be declared in an extension
101+
// to Tag.
102102
struct Food {
103-
@Tag var needsMustard: Self // ❌ ERROR: tags must be declared in an extension
104-
// to Tag
103+
@Tag var needsMustard: Self // ❌ ERROR: Tags must be declared in an extension
104+
// to Tag.
105105
}
106106
```
107107

@@ -110,7 +110,7 @@ HIDDEN: tag colors are experimental SPI.
110110
111111
## Built-in tags
112112
113-
The testing library predefines the following symbolic tags that can be used in
113+
The testing library predefines the following symbolic tags that you can use in
114114
any test target and applied to any test:
115115
116116
- ``Tag/red``
@@ -120,18 +120,18 @@ any test target and applied to any test:
120120
- ``Tag/blue``
121121
- ``Tag/purple``
122122
123-
The testing library does not assign any semantic meaning to these tags, nor does
123+
The testing library doesn't assign any semantic meaning to these tags, nor does
124124
the presence or absence of these tags affect how the testing library runs tests.
125125
126126
## Customize a tag's appearance
127127
128-
By default, a tag does not appear in a test's output when the test is run. It is
128+
By default, a tag doesn't appear in a test's output when the test is run. It's
129129
possible to assign colors to tags defined in a package so that when the test is
130130
run, the tag is visible in its output.
131131
132132
To add colors to tags, create a directory in your home directory named
133133
`".swift-testing"` and add a file named `"tag-colors.json"` to it. This file
134-
should contain a JSON object (a dictionary) whose keys are strings representing
134+
should contain a JSON object (a dictionary) whose keys are strings that represent
135135
tags and whose values represent tag colors.
136136
137137
- Note: On Windows, create the `".swift-testing"` directory in the
@@ -141,15 +141,15 @@ tags and whose values represent tag colors.
141141
Tag colors can be represented using several formats:
142142
143143
- The strings `"red"`, `"orange"`, `"yellow"`, `"green"`, `"blue"`, or
144-
`"purple"`, representing corresponding predefined instances of ``Tag``, i.e.
144+
`"purple"`, representing corresponding predefined instances of ``Tag``, like
145145
``Tag/red``, ``Tag/orange``, ``Tag/yellow``, ``Tag/green``, ``Tag/blue``, and
146-
``Tag/purple``;
146+
``Tag/purple``.
147147
- A string of the form `"#RRGGBB"`, containing a hexadecimal representation of
148-
the color in a device-independent RGB color space; or
149-
- The `null` literal value, representing "no color."
148+
the color in a device-independent RGB color space.
149+
- The `null` literal value, which represents no color.
150150
151-
For example, to set the color of the tag `"critical"` to orange and the color of
152-
the tag `.legallyRequired` to teal, the contents of `"tag-colors.json"` can
151+
For example, to set the color of the `"critical"` tag to orange and the color of
152+
the `.legallyRequired` tag to teal, the contents of `"tag-colors.json"` can
153153
be set to:
154154
155155
```json

Sources/Testing/Testing.docc/AssociatingBugs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Associate bugs uncovered or verified by tests.
1515
## Overview
1616

1717
Tests allow developers to prove that the code they write is working as expected.
18-
If code is not working correctly, bug trackers are often used to track the work
19-
necessary to fix the underlying problem. It is often useful to associate
18+
If code isn't working correctly, bug trackers are often used to track the work
19+
necessary to fix the underlying problem. It's often useful to associate
2020
specific bugs with tests that reproduce them or verify they are fixed.
2121

2222
- Note: "Bugs" as described in this document may also be referred to as

Sources/Testing/Testing.docc/BugIdentifiers.md

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

13-
How the testing library interprets bug identifiers provided by developers.
13+
Examine how the testing library interprets bug identifiers provided by developers.
1414

1515
## Overview
1616

@@ -21,17 +21,17 @@ formats are associated with some common bug-tracking systems.
2121
"issues." To avoid confusion with the ``Issue`` type in the testing library,
2222
this document consistently refers to them as "bugs."
2323

24-
## Recognized formats
24+
### Recognized formats
2525

2626
- If the bug identifier begins with `"rdar:"`, it is assumed to represent a bug
2727
filed with Apple's Radar system.
2828
- If the bug identifier can be parsed as a URL according to
2929
[RFC 3986](https://www.ietf.org/rfc/rfc3986.txt), it is assumed to represent
3030
an issue tracked at that URL.
3131
- If the bug identifier begins with `"FB"` and the rest of it can be parsed as
32-
an unsigned integer, it is assumed to represent a bug filed with the
32+
an unsigned integer, it's assumed to represent a bug filed with the
3333
[Apple Feedback Assistant](https://feedbackassistant.apple.com).
34-
- If the bug identifier can be parsed as an unsigned integer, it is assumed to
34+
- If the bug identifier can be parsed as an unsigned integer, it's assumed to
3535
represent an issue with that numeric identifier in an unspecified bug-tracking
3636
system.
3737
- All other bug identifiers are considered invalid and will cause the compiler
@@ -46,9 +46,9 @@ handling to detect:
4646
the same repository as the test.
4747
-->
4848

49-
## Examples
49+
### Examples
5050

51-
| Trait Function | Valid | Inferred Bug-Tracking System |
51+
| Trait function | Valid | Inferred bug-tracking system |
5252
|-|:-:|-|
5353
| `.bug(12345)` | Yes | None |
5454
| `.bug("12345")` | Yes | None |

Sources/Testing/Testing.docc/DefiningTests.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This article assumes that the package or project being tested has already been
2020
configured with a test target. For help configuring a package to use the testing
2121
library, see <doc:TemporaryGettingStarted>.
2222

23-
## Import the testing library
23+
### Import the testing library
2424

2525
To import the testing library, add the following to the Swift source file that
2626
contains the test:
@@ -30,12 +30,12 @@ import Testing
3030
```
3131

3232
- Note: Only import the testing library into a test target. Importing the
33-
testing library into an application, library, or binary target is not
34-
supported or recommended. Test functions are not stripped from binaries when
33+
testing library into an application, library, or binary target isn't
34+
supported or recommended. Test functions aren't stripped from binaries when
3535
building for release, so logic and fixtures of a test may be visible to anyone
3636
who inspects a build product that contains a test function.
3737

38-
## Declare a test function
38+
### Declare a test function
3939

4040
To declare a test function, write a Swift function declaration that doesn't
4141
take any arguments, then prefix its name with the `@Test` attribute:
@@ -51,11 +51,11 @@ containing test functions is automatically a _test suite_ and can be optionally
5151
annotated with the `@Suite` attribute. For more information about suites, see
5252
<doc:OrganizingTests>.
5353

54-
Note that, while this function is a valid test function, it does not actually
54+
Note that, while this function is a valid test function, it doesn't actually
5555
perform any action or test any code. To check for expected values and outcomes
5656
in test functions, add [expectations](doc:Expectations) to the test function.
5757

58-
## Customize a test's name
58+
### Customize a test's name
5959

6060
To customize a test function's name as presented in an IDE or at the command
6161
line, supply a string literal as an argument to the `@Test` attribute:
@@ -67,7 +67,7 @@ line, supply a string literal as an argument to the `@Test` attribute:
6767
To further customize the appearance and behavior of a test function, use
6868
[traits](doc:Traits) such as ``Trait/tags(_:)-505n9``.
6969

70-
## Writing concurrent or throwing tests
70+
### Write concurrent or throwing tests
7171

7272
As with other Swift functions, test functions can be marked `async` and `throws`
7373
to annotate them as concurrent or throwing, respectively. If a test is only safe
@@ -78,7 +78,7 @@ the process), it can be annotated `@MainActor`:
7878
@Test @MainActor func foodTruckExists() async throws { ... }
7979
```
8080

81-
## Limit the availability of a test
81+
### Limit the availability of a test
8282

8383
If a test function can only run on newer versions of an operating system or of
8484
the Swift language, use the `@available` attribute when declaring it. Use the

Sources/Testing/Testing.docc/EnablingAndDisabling.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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,15 +14,15 @@ Conditionally enable or disable individual tests before they run.
1414

1515
## Overview
1616

17-
Often, a test will only be applicable in specific circumstances. For instance,
17+
Often, a test is only applicable in specific circumstances. For instance,
1818
you might want to write a test that only runs on devices with particular
1919
hardware capabilities, or performs locale-dependent operations. The testing
2020
library allows you to add traits to your tests that cause runners to
2121
automatically skip them if conditions like these are not met.
2222

2323
- Note: A condition may be evaluated multiple times during testing.
2424

25-
## Disable a test
25+
### Disable a test
2626

2727
If you need to disable a test unconditionally, use the
2828
``Trait/disabled(_:fileID:filePath:line:column:)`` function. Given the following
@@ -42,15 +42,15 @@ func sellsBurritos() async throws { ... }
4242

4343
The test will now always be skipped.
4444

45-
It is also possible to add a comment to the trait to present in the output from
45+
It's also possible to add a comment to the trait to present in the output from
4646
the runner when it skips the test:
4747

4848
```swift
4949
@Test("Food truck sells burritos", .disabled("We only sell Thai cuisine"))
5050
func sellsBurritos() async throws { ... }
5151
```
5252

53-
## Conditionally enable or disable a test
53+
### Enable or disable a test conditionally
5454

5555
Sometimes, it makes sense to enable a test only when a certain condition is met. Consider
5656
the following test function:
@@ -60,17 +60,16 @@ the following test function:
6060
func isCold() async throws { ... }
6161
```
6262

63-
If it is currently winter, then presumably ice cream will not be available for
64-
sale and this test will fail. It therefore makes sense to only enable it if it
65-
is currently summer. You can conditionally enable a test with
63+
If it's currently winter, then presumably ice cream won't be available for
64+
sale and this test will fail. It therefore makes sense to only enable it if it's currently summer. You can conditionally enable a test with
6665
``Trait/enabled(if:_:fileID:filePath:line:column:)``:
6766

6867
```swift
6968
@Test("Ice cream is cold", .enabled(if: Season.current == .summer))
7069
func isCold() async throws { ... }
7170
```
7271

73-
It is also possible to conditionally _disable_ a test and to combine multiple
72+
It's also possible to conditionally _disable_ a test and to combine multiple
7473
conditions:
7574

7675
```swift
@@ -100,7 +99,7 @@ If a test has multiple conditions applied to it, they must _all_ pass for it to
10099
run. Otherwise, the test notes the first condition to fail as the reason the test
101100
is skipped.
102101

103-
## Handle complex conditions
102+
### Handle complex conditions
104103

105104
If a condition is complex, consider factoring it out into a helper function to
106105
improve readability:

Sources/Testing/Testing.docc/LimitingExecutionTime.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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
@@ -19,8 +19,7 @@ resources to complete, may rely on downloaded data from a server, or may
1919
otherwise be dependent on external factors.
2020

2121
If a test may hang indefinitely or may consume too many system resources to
22-
complete effectively, consider setting a time limit for it so that it will
23-
be marked as failing if it runs for an excessive amount of time. Use the
22+
complete effectively, consider setting a time limit for it so that it's marked as failing if it runs for an excessive amount of time. Use the
2423
``Trait/timeLimit(_:)`` trait as an upper bound:
2524

2625
```swift
@@ -34,13 +33,13 @@ func serve100CustomersInOneHour() async {
3433
}
3534
```
3635

37-
If the above test function takes longer than 60 &times; 60 seconds (i.e. one
38-
hour) to execute, the task in which it is running will be
36+
If the above test function takes longer than an
37+
hour (60 x 60 seconds) to execute, the task in which it's running is
3938
[cancelled](https://developer.apple.com/documentation/swift/task/cancel())
40-
and the test will fail with an issue of kind
39+
and the test fails with an issue of kind
4140
``Issue/Kind-swift.enum/timeLimitExceeded(timeLimitComponents:)``.
4241

43-
- Note: if multiple time limit traits apply to a test, the shortest time limit
42+
- Note: If multiple time limit traits apply to a test, the shortest time limit
4443
is used.
4544

4645
The testing library may adjust the specified time limit for performance reasons
@@ -51,11 +50,11 @@ limit traits.
5150

5251
### Time limits applied to test suites
5352

54-
When a time limit is applied to a test suite, it is recursively applied to all
53+
When a time limit is applied to a test suite, it's recursively applied to all
5554
test functions and child test suites within that suite.
5655

5756
### Time limits applied to parameterized tests
5857

59-
When a time limit is applied to a parameterized test function, it is applied to
58+
When a time limit is applied to a parameterized test function, it's applied to
6059
each invocation _separately_ so that if only some arguments cause failures, then
61-
successful arguments are not incorrectly marked as failing too.
60+
successful arguments aren't incorrectly marked as failing too.

0 commit comments

Comments
 (0)