Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Provide an API and macro for setting the timeout of a shouldEventuall…

…y matcher.
  • Loading branch information...
commit fb3863db5389479aa1819d75d45f0c44898bf766 1 parent 9c63e2d
Luke Redpath authored
2  Kiwi/KWSpec.h
@@ -38,7 +38,7 @@
38 38 - (id)addVerifier:(id<KWVerifying>)aVerifier;
39 39 - (id)addExistVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite;
40 40 - (id)addMatchVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite;
41   -- (id)addAsyncVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite;
  41 +- (id)addAsyncVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite timeout:(NSInteger)timeout;
42 42
43 43 #pragma mark -
44 44 #pragma mark Building Example Groups
4 Kiwi/KWSpec.m
@@ -103,8 +103,8 @@ - (id)addMatchVerifierWithExpectationType:(KWExpectationType)anExpectationType c
103 103 return verifier;
104 104 }
105 105
106   -- (id)addAsyncVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite {
107   - id verifier = [KWAsyncVerifier asyncVerifierWithExpectationType:anExpectationType callSite:aCallSite matcherFactory:self.matcherFactory reporter:self probeTimeout:kKW_DEFAULT_PROBE_TIMEOUT];
  106 +- (id)addAsyncVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite timeout:(NSInteger)timeout {
  107 + id verifier = [KWAsyncVerifier asyncVerifierWithExpectationType:anExpectationType callSite:aCallSite matcherFactory:self.matcherFactory reporter:self probeTimeout:timeout];
108 108 [self addVerifier:verifier];
109 109 return verifier;
110 110 }
2  Kiwi/KWTestCase.h
@@ -40,6 +40,6 @@
40 40 - (id)addVerifier:(id<KWVerifying>)aVerifier;
41 41 - (id)addExistVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite;
42 42 - (id)addMatchVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite;
43   -- (id)addAsyncVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite;
  43 +- (id)addAsyncVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite timeout:(NSInteger)timeout;
44 44
45 45 @end
4 Kiwi/KWTestCase.m
@@ -106,8 +106,8 @@ - (id)addMatchVerifierWithExpectationType:(KWExpectationType)anExpectationType c
106 106 return verifier;
107 107 }
108 108
109   -- (id)addAsyncVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite {
110   - id verifier = [KWAsyncVerifier asyncVerifierWithExpectationType:anExpectationType callSite:aCallSite matcherFactory:self.matcherFactory reporter:self probeTimeout:kKW_DEFAULT_PROBE_TIMEOUT];
  109 +- (id)addAsyncVerifierWithExpectationType:(KWExpectationType)anExpectationType callSite:(KWCallSite *)aCallSite timeout:(NSInteger)timeout {
  110 + id verifier = [KWAsyncVerifier asyncVerifierWithExpectationType:anExpectationType callSite:aCallSite matcherFactory:self.matcherFactory reporter:self probeTimeout:timeout];
111 111 [self.verifiers addObject:verifier];
112 112 return verifier;
113 113 }
5 Kiwi/KiwiMacros.h
@@ -12,7 +12,7 @@
12 12 #define KW_THIS_CALLSITE [KWCallSite callSiteWithFilename:@__FILE__ lineNumber:__LINE__]
13 13 #define KW_ADD_EXIST_VERIFIER(expectationType) [self addExistVerifierWithExpectationType:expectationType callSite:KW_THIS_CALLSITE]
14 14 #define KW_ADD_MATCH_VERIFIER(expectationType) [self addMatchVerifierWithExpectationType:expectationType callSite:KW_THIS_CALLSITE]
15   -#define KW_ADD_ASYNC_VERIFIER(expectationType) [self addAsyncVerifierWithExpectationType:expectationType callSite:KW_THIS_CALLSITE]
  15 +#define KW_ADD_ASYNC_VERIFIER(expectationType, timeOut) [self addAsyncVerifierWithExpectationType:expectationType callSite:KW_THIS_CALLSITE timeout:timeOut]
16 16
17 17 #pragma mark -
18 18 #pragma mark Keywords
@@ -22,7 +22,8 @@
22 22 #define shouldNot attachToVerifier:KW_ADD_MATCH_VERIFIER(KWExpectationTypeShouldNot) verifier:KW_ADD_EXIST_VERIFIER(KWExpectationTypeShould)
23 23 #define shouldBeNil attachToVerifier:KW_ADD_EXIST_VERIFIER(KWExpectationTypeShouldNot)
24 24 #define shouldNotBeNil attachToVerifier:KW_ADD_EXIST_VERIFIER(KWExpectationTypeShould)
25   -#define shouldEventually attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShould)
  25 +#define shouldEventually attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShould, kKW_DEFAULT_PROBE_TIMEOUT)
  26 +#define shouldEventuallyBeforeTimingOutAfter(timeout) attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShould, timeout)
26 27
27 28 // used to wrap a pointer to an object that will change in the future (used with shouldEventually)
28 29 #define theObject(objectPtr) [KWFutureObject objectWithObjectPointer:objectPtr]

0 comments on commit fb3863d

Please sign in to comment.
Something went wrong with that request. Please try again.