forked from kiwi-bdd/Kiwi
/
KWBeEmptyMatcherTest.m
50 lines (38 loc) · 1.38 KB
/
KWBeEmptyMatcherTest.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
//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//
#import "Kiwi.h"
#import "KiwiTestConfiguration.h"
#import "TestClasses.h"
#if KW_TESTS_ENABLED
@interface KWEmptyCollectionMatcherTest : SenTestCase
@end
@implementation KWEmptyCollectionMatcherTest
- (void)testItShouldHaveTheRightMatcherStrings {
NSArray *matcherStrings = [KWBeEmptyMatcher matcherStrings];
NSArray *expectedStrings = @[@"beEmpty"];
STAssertEqualObjects([matcherStrings sortedArrayUsingSelector:@selector(compare:)],
[expectedStrings sortedArrayUsingSelector:@selector(compare:)],
@"expected specific matcher strings");
}
- (void)testItShouldMatchEmptyCollections {
id subject = @{};
id matcher = [KWBeEmptyMatcher matcherWithSubject:subject];
[matcher beEmpty];
STAssertTrue([matcher evaluate], @"expected positive match");
}
- (void)testItShouldNotMatchNonEmptyCollections {
id subject = @{@"foo": @"bar"};
id matcher = [KWBeEmptyMatcher matcherWithSubject:subject];
[matcher beEmpty];
STAssertFalse([matcher evaluate], @"expected negative match");
}
- (void)testItShouldHaveHumanReadableDescription
{
id matcher = [KWBeEmptyMatcher matcherWithSubject:nil];
STAssertEqualObjects(@"be empty", [matcher description], @"description should match");
}
@end
#endif // #if KW_TESTS_ENABLED