Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

74 lines (52 sloc) 1.194 kB
//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//
#import "TestReporter.h"
#import "KWFailure.h"
@interface TestReporter()
#pragma mark -
#pragma mark Properties
@property (nonatomic, readwrite) BOOL hasUnmetExpectations;
@end
@implementation TestReporter
#pragma mark -
#pragma mark Initializing
- (id)init {
if ((self = [super init])) {
failures = [[NSMutableArray alloc] init];
}
return self;
}
+ (id)testReporter {
return [[[self alloc] init] autorelease];
}
- (void)dealloc {
[failures release];
[super dealloc];
}
#pragma mark -
#pragma mark Properties
@synthesize hasUnmetExpectations;
@synthesize failures;
#pragma mark -
#pragma mark Reporting Failures
- (void)reportFailure:(KWFailure *)aFailure {
if (aFailure == nil)
return;
self.hasUnmetExpectations = YES;
[failures addObject:aFailure];
}
#pragma mark -
#pragma mark Getting Failure Information
- (BOOL)hasNoFailure {
return [self.failures count] == 0;
}
- (BOOL)hasOneFailure {
return [self.failures count] == 1;
}
- (KWFailure *)onlyFailure {
return [self.failures objectAtIndex:0];
}
@end
Jump to Line
Something went wrong with that request. Please try again.