Skip to content

Commit a417230

Browse files
committed
Update documentation comments in the code samples
1 parent c939b48 commit a417230

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

proposals/testing/NNNN-polling-confirmations.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,18 @@ testing library:
139139
/// Poll expression within the duration based on the given stop condition
140140
///
141141
/// - Parameters:
142-
/// - comment: An optional comment to apply to any issues generated by this
143-
/// function.
142+
/// - comment: A user-specified comment describing this confirmation.
144143
/// - stopCondition: When to stop polling.
145144
/// - duration: The expected length of time to continue polling for.
146-
/// This value may not correspond to the wall-clock time that polling lasts
147-
/// for, especially on highly-loaded systems with a lot of tests running.
145+
/// This value does not incorporate the time to run `body`, and may not
146+
/// correspond to the wall-clock time that polling lasts for, especially on
147+
/// highly-loaded systems with a lot of tests running.
148148
/// If nil, this uses whatever value is specified under the last
149149
/// ``PollingConfirmationConfigurationTrait`` added to the test or suite
150150
/// with a matching stopCondition.
151151
/// If no such trait has been added, then polling will be attempted for
152152
/// about 1 second before recording an issue.
153-
/// `duration` must be greater than 0.
153+
/// `duration` must be greater than or equal to `interval`.
154154
/// - interval: The minimum amount of time to wait between polling attempts.
155155
/// If nil, this uses whatever value is specified under the last
156156
/// ``PollingConfirmationConfigurationTrait`` added to the test or suite
@@ -159,9 +159,10 @@ testing library:
159159
/// 1 millisecond between polling attempts.
160160
/// `interval` must be greater than 0.
161161
/// - isolation: The actor to which `body` is isolated, if any.
162-
/// - sourceLocation: The source location to whych any recorded issues should
163-
/// be attributed.
164-
/// - body: The function to invoke.
162+
/// - sourceLocation: The location in source where the confirmation was called.
163+
/// - body: The function to invoke. The expression is considered to pass if
164+
/// the `body` returns true. Similarly, the expression is considered to fail
165+
/// if `body` returns false.
165166
///
166167
/// - Throws: A `PollingFailedError` if the `body` does not return true within
167168
/// the polling duration.
@@ -184,18 +185,18 @@ public func confirmation(
184185
/// Confirm that some expression eventually returns a non-nil value
185186
///
186187
/// - Parameters:
187-
/// - comment: An optional comment to apply to any issues generated by this
188-
/// function.
188+
/// - comment: A user-specified comment describing this confirmation.
189189
/// - stopCondition: When to stop polling.
190190
/// - duration: The expected length of time to continue polling for.
191-
/// This value may not correspond to the wall-clock time that polling lasts
192-
/// for, especially on highly-loaded systems with a lot of tests running.
191+
/// This value does not incorporate the time to run `body`, and may not
192+
/// correspond to the wall-clock time that polling lasts for, especially on
193+
/// highly-loaded systems with a lot of tests running.
193194
/// If nil, this uses whatever value is specified under the last
194195
/// ``PollingConfirmationConfigurationTrait`` added to the test or suite
195196
/// with a matching stopCondition.
196197
/// If no such trait has been added, then polling will be attempted for
197198
/// about 1 second before recording an issue.
198-
/// `duration` must be greater than 0.
199+
/// `duration` must be greater than or equal to `interval`.
199200
/// - interval: The minimum amount of time to wait between polling attempts.
200201
/// If nil, this uses whatever value is specified under the last
201202
/// ``PollingConfirmationConfigurationTrait`` added to the test or suite
@@ -204,9 +205,10 @@ public func confirmation(
204205
/// 1 millisecond between polling attempts.
205206
/// `interval` must be greater than 0.
206207
/// - isolation: The actor to which `body` is isolated, if any.
207-
/// - sourceLocation: The source location to whych any recorded issues should
208-
/// be attributed.
209-
/// - body: The function to invoke.
208+
/// - sourceLocation: The location in source where the confirmation was called.
209+
/// - body: The function to invoke. The expression is considered to pass if
210+
/// the `body` returns a non-nil value. Similarly, the expression is
211+
/// considered to fail if `body` returns nil.
210212
///
211213
/// - Throws: A `PollingFailedError` if the `body` does not return true within
212214
/// the polling duration.
@@ -240,17 +242,17 @@ how the confirmation should be handled.
240242
```swift
241243
/// A type defining when to stop polling early.
242244
/// This also determines what happens if the duration elapses during polling.
243-
public enum PollingStopCondition: Sendable, Equatable {
244-
/// Evaluates the expression until the first time it returns true.
245-
/// If it does not pass once by the time the timeout is reached, then a
245+
public enum PollingStopCondition: Sendable, Equatable, Codable {
246+
/// Evaluates the expression until the first time it passes
247+
/// If it does not pass once by the time the duration is reached, then a
246248
/// failure will be reported.
247249
case firstPass
248250

249-
/// Evaluates the expression until the first time it returns false.
250-
/// If the expression returns false, then a failure will be reported.
251-
/// If the expression only returns true before the timeout is reached, then
251+
/// Evaluates the expression until the first time it returns fails.
252+
/// If the expression fails, then a failure will be reported.
253+
/// If the expression only passes before the duration is reached, then
252254
/// no failure will be reported.
253-
/// If the expression does not finish evaluating before the timeout is
255+
/// If the expression does not finish evaluating before the duration is
254256
/// reached, then a failure will be reported.
255257
case stopsPassing
256258
}
@@ -360,7 +362,7 @@ extension Trait where Self == PollingConfirmationConfigurationTrait {
360362
/// lasts for, especially on highly-loaded systems with a lot of tests
361363
/// running.
362364
/// if nil, polling will be attempted for approximately 1 second.
363-
/// `duration` must be greater than 0.
365+
/// `duration` must be greater than `interval`.
364366
/// - interval: The minimum amount of time to wait between polling
365367
/// attempts.
366368
/// If nil, polling will wait at least 1 millisecond between polling

0 commit comments

Comments
 (0)