1010
1111/// Default values for polling confirmations.
1212@available ( _clockAPI, * )
13- internal let defaultPollingConfiguration = (
13+ private let _defaultPollingConfiguration = (
1414 pollingDuration: Duration . seconds ( 1 ) ,
1515 pollingInterval: Duration . milliseconds ( 1 )
1616)
@@ -33,24 +33,23 @@ public enum PollingStopCondition: Sendable, Equatable, Codable {
3333 case stopsPassing
3434}
3535
36- /// A type describing why polling failed
37- @_spi ( Experimental)
38- public enum PollingFailureReason : Sendable , Codable {
39- /// The polling failed because it was cancelled using `Task.cancel`.
40- case cancelled
41-
42- /// The polling failed because the stop condition failed.
43- case stopConditionFailed( PollingStopCondition )
44- }
45-
4636/// A type describing an error thrown when polling fails.
4737@_spi ( Experimental)
4838public struct PollingFailedError : Error , Sendable , Codable {
39+ /// A type describing why polling failed
40+ public enum Reason : Sendable , Codable {
41+ /// The polling failed because it was cancelled using `Task.cancel`.
42+ case cancelled
43+
44+ /// The polling failed because the stop condition failed.
45+ case stopConditionFailed( PollingStopCondition )
46+ }
47+
4948 /// A user-specified comment describing this confirmation
5049 public var comment : Comment ?
5150
5251 /// Why polling failed, either cancelled, or because the stop condition failed.
53- public var reason : PollingFailureReason
52+ public var reason : Reason
5453
5554 /// A ``SourceContext`` indicating where and how this confirmation was called
5655 @_spi ( ForToolsIntegrationOnly)
@@ -66,7 +65,7 @@ public struct PollingFailedError: Error, Sendable, Codable {
6665 /// confirmation was called.
6766 init (
6867 comment: Comment ? = nil ,
69- reason: PollingFailureReason ,
68+ reason: Reason ,
7069 sourceContext: SourceContext ,
7170 ) {
7271 self . comment = comment
@@ -229,7 +228,7 @@ public func confirmation<R>(
229228/// - providedValue: The value provided by the test author when calling
230229/// `confirmPassesEventually` or `confirmAlwaysPasses`.
231230/// - default: The harded coded default value, as defined in
232- /// `defaultPollingConfiguration `.
231+ /// `_defaultPollingConfiguration `.
233232/// - keyPath: The keyPath mapping from `TraitKind` to the value type.
234233///
235234/// - Returns: The value to use.
@@ -293,27 +292,27 @@ extension PollingStopCondition {
293292
294293 /// Determine the polling duration to use for the given provided value.
295294 /// Based on ``getValueFromTrait``, this falls back using
296- /// ``defaultPollingConfiguration .pollingInterval`` and
295+ /// ``_defaultPollingConfiguration .pollingInterval`` and
297296 /// ``PollingUntilFirstPassConfigurationTrait``.
298297 @available ( _clockAPI, * )
299298 fileprivate func duration( with provided: Duration ? ) -> Duration {
300299 getValueFromTrait (
301300 providedValue: provided,
302- default: defaultPollingConfiguration . pollingDuration,
301+ default: _defaultPollingConfiguration . pollingDuration,
303302 \PollingConfirmationConfigurationTrait . duration,
304303 where: { $0. stopCondition == self }
305304 )
306305 }
307306
308307 /// Determine the polling interval to use for the given provided value.
309308 /// Based on ``getValueFromTrait``, this falls back using
310- /// ``defaultPollingConfiguration .pollingInterval`` and
309+ /// ``_defaultPollingConfiguration .pollingInterval`` and
311310 /// ``PollingUntilFirstPassConfigurationTrait``.
312311 @available ( _clockAPI, * )
313312 fileprivate func interval( with provided: Duration ? ) -> Duration {
314313 getValueFromTrait (
315314 providedValue: provided,
316- default: defaultPollingConfiguration . pollingInterval,
315+ default: _defaultPollingConfiguration . pollingInterval,
317316 \PollingConfirmationConfigurationTrait . interval,
318317 where: { $0. stopCondition == self }
319318 )
@@ -390,7 +389,7 @@ private struct Poller {
390389 // if Int(exactly:) returns nil, then that generally means the value is too
391390 // large. In which case, we should fall back to Int.max.
392391
393- let failureReason : PollingFailureReason
392+ let failureReason : PollingFailedError . Reason
394393 switch await poll ( iterations: iterations, expression: body) {
395394 case let . succeeded( value) :
396395 return value
0 commit comments