-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a TestReporter spec helper for examining reporting behavior
- Loading branch information
1 parent
cd46929
commit d66585f
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#import <Foundation/Foundation.h> | ||
#import "Cedar.h" | ||
#import "CDRNullabilityCompat.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface TestReporter : NSObject <CDRExampleReporter> | ||
|
||
@property (nonatomic, readonly) NSArray *startedExamples; | ||
@property (nonatomic, readonly) NSArray *finishedExamples; | ||
|
||
@property (nonatomic, readonly) NSArray *startedExampleGroups; | ||
@property (nonatomic, readonly) NSArray *finishedExampleGroups; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#import "TestReporter.h" | ||
|
||
#if !__has_feature(objc_arc) | ||
#error This class must be compiled with ARC. | ||
#endif | ||
|
||
@implementation TestReporter { | ||
NSMutableArray *_startedExamples; | ||
NSMutableArray *_finishedExamples; | ||
NSMutableArray *_startedExampleGroups; | ||
NSMutableArray *_finishedExampleGroups; | ||
} | ||
|
||
- (instancetype)init { | ||
if (self = [super init]) { | ||
_startedExamples = [NSMutableArray array]; | ||
_finishedExamples = [NSMutableArray array]; | ||
_startedExampleGroups = [NSMutableArray array]; | ||
_finishedExampleGroups = [NSMutableArray array]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)runWillStartWithGroups:(NSArray *)groups andRandomSeed:(unsigned int)seed {} | ||
- (void)runDidComplete {} | ||
- (int)result { | ||
return 0; | ||
} | ||
|
||
- (void)runWillStartExample:(CDRExample *)example { | ||
[_startedExamples addObject:example]; | ||
} | ||
- (void)runDidFinishExample:(CDRExample *)example { | ||
[_finishedExamples addObject:example]; | ||
} | ||
|
||
- (void)runWillStartExampleGroup:(CDRExampleGroup *)exampleGroup { | ||
[_startedExampleGroups addObject:exampleGroup]; | ||
} | ||
- (void)runDidFinishExampleGroup:(CDRExampleGroup *)exampleGroup { | ||
[_finishedExampleGroups addObject:exampleGroup]; | ||
} | ||
|
||
- (void)runWillStartSpec:(CDRSpec *)spec {} | ||
- (void)runDidFinishSpec:(CDRSpec *)spec {} | ||
|
||
@end |