forked from kiwi-bdd/Kiwi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKWGenericMatcher.m
62 lines (45 loc) · 1.03 KB
/
KWGenericMatcher.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// KWGenericMatcher.m
// Kiwi
//
// Created by Luke Redpath on 24/01/2011.
// Copyright 2011 Allen Ding. All rights reserved.
//
#import "KWGenericMatcher.h"
#import "KWGenericMatchEvaluator.h"
@interface KWGenericMatcher ()
#pragma mark -
#pragma mark Properties
@property (nonatomic, retain) id matcher;
@end
@implementation KWGenericMatcher
@synthesize matcher;
- (void)dealloc
{
[matcher release];
[super dealloc];
}
#pragma mark -
#pragma mark Matching
- (BOOL)evaluate {
return [KWGenericMatchEvaluator genericMatcher:self.matcher matches:self.subject];
}
- (NSString *)failureMessageForShould {
return [NSString stringWithFormat:@"expected subject to match %@", self.matcher];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"match %@", [self.matcher description]];
}
#pragma mark -
#pragma mark Getting Matcher Strings
+ (NSArray *)matcherStrings {
return @[@"match:"];
}
#pragma mark -
#pragma mark Configuring Matchers
- (void)match:(id)aMatcher;
{
self.matcher = aMatcher;
}
@end