Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 74 lines (52 sloc) 1.194 kb
4f0c627 @allending First release.
authored
1 //
2 // Licensed under the terms in License.txt
3 //
4 // Copyright 2010 Allen Ding. All rights reserved.
5 //
6
7 #import "TestReporter.h"
8 #import "KWFailure.h"
9
10 @interface TestReporter()
11
12 #pragma mark -
13 #pragma mark Properties
14
15 @property (nonatomic, readwrite) BOOL hasUnmetExpectations;
16
17 @end
18
19 @implementation TestReporter
20
21 #pragma mark -
22 #pragma mark Initializing
23
24 - (id)init {
25 if ((self = [super init])) {
26 failures = [[NSMutableArray alloc] init];
27 }
b940a6e @mattdipasquale Convert \t to 4 spaces. Rm trailing whitespace.
mattdipasquale authored
28
4f0c627 @allending First release.
authored
29 return self;
30 }
31
32 + (id)testReporter {
33 return [[[self alloc] init] autorelease];
34 }
35
36 - (void)dealloc {
37 [failures release];
38 [super dealloc];
39 }
40
41 #pragma mark -
42 #pragma mark Properties
43
44 @synthesize hasUnmetExpectations;
45 @synthesize failures;
46
47 #pragma mark -
48 #pragma mark Reporting Failures
49
50 - (void)reportFailure:(KWFailure *)aFailure {
51 if (aFailure == nil)
52 return;
b940a6e @mattdipasquale Convert \t to 4 spaces. Rm trailing whitespace.
mattdipasquale authored
53
4f0c627 @allending First release.
authored
54 self.hasUnmetExpectations = YES;
55 [failures addObject:aFailure];
56 }
57
58 #pragma mark -
59 #pragma mark Getting Failure Information
60
61 - (BOOL)hasNoFailure {
62 return [self.failures count] == 0;
63 }
64
65 - (BOOL)hasOneFailure {
66 return [self.failures count] == 1;
67 }
68
69 - (KWFailure *)onlyFailure {
70 return [self.failures objectAtIndex:0];
71 }
72
73 @end
Something went wrong with that request. Please try again.