@@ -2,12 +2,17 @@ import Foundation
22
33#if _runtime(_ObjC)
44
5+ public struct AsyncDefaults {
6+ public static var Timeout : NSTimeInterval = 1
7+ public static var PollInterval : NSTimeInterval = 0.01
8+ }
9+
510internal struct AsyncMatcherWrapper < T, U where U: Matcher , U. ValueType == T > : Matcher {
611 let fullMatcher : U
712 let timeoutInterval : NSTimeInterval
813 let pollInterval : NSTimeInterval
914
10- init ( fullMatcher: U , timeoutInterval: NSTimeInterval = 1 , pollInterval: NSTimeInterval = 0.01 ) {
15+ init ( fullMatcher: U , timeoutInterval: NSTimeInterval = AsyncDefaults . Timeout , pollInterval: NSTimeInterval = AsyncDefaults . PollInterval ) {
1116 self . fullMatcher = fullMatcher
1217 self . timeoutInterval = timeoutInterval
1318 self . pollInterval = pollInterval
@@ -79,7 +84,7 @@ extension Expectation {
7984 /// @discussion
8085 /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
8186 /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
82- public func toEventually< U where U: Matcher , U. ValueType == T > ( matcher: U , timeout: NSTimeInterval = 1 , pollInterval: NSTimeInterval = 0.01 , description: String ? = nil ) {
87+ public func toEventually< U where U: Matcher , U. ValueType == T > ( matcher: U , timeout: NSTimeInterval = AsyncDefaults . Timeout , pollInterval: NSTimeInterval = AsyncDefaults . PollInterval , description: String ? = nil ) {
8388 if expression. isClosure {
8489 let ( pass, msg) = expressionMatches (
8590 expression,
@@ -102,7 +107,7 @@ extension Expectation {
102107 /// @discussion
103108 /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
104109 /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
105- public func toEventuallyNot< U where U: Matcher , U. ValueType == T > ( matcher: U , timeout: NSTimeInterval = 1 , pollInterval: NSTimeInterval = 0.01 , description: String ? = nil ) {
110+ public func toEventuallyNot< U where U: Matcher , U. ValueType == T > ( matcher: U , timeout: NSTimeInterval = AsyncDefaults . Timeout , pollInterval: NSTimeInterval = AsyncDefaults . PollInterval , description: String ? = nil ) {
106111 if expression. isClosure {
107112 let ( pass, msg) = expressionDoesNotMatch (
108113 expression,
@@ -127,7 +132,7 @@ extension Expectation {
127132 /// @discussion
128133 /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
129134 /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
130- public func toNotEventually< U where U: Matcher , U. ValueType == T > ( matcher: U , timeout: NSTimeInterval = 1 , pollInterval: NSTimeInterval = 0.01 , description: String ? = nil ) {
135+ public func toNotEventually< U where U: Matcher , U. ValueType == T > ( matcher: U , timeout: NSTimeInterval = AsyncDefaults . Timeout , pollInterval: NSTimeInterval = AsyncDefaults . PollInterval , description: String ? = nil ) {
131136 return toEventuallyNot ( matcher, timeout: timeout, pollInterval: pollInterval, description: description)
132137 }
133138}
0 commit comments