URLManager?е????????????
???????????? ???????[ 2015/1/8 14:09:32 ] ?????????????????? ??????? ????????
(void)testAddConfig
{
[UMNavigationController setViewControllerName:@"ViewControllerA" forURL:@"
um://viewa2"];
NSMutableDictionary *config = [UMNavigationController config];
NSLog(@"%@"?? [config allKeys]);
HC_assertThat([config allKeys]??
HC_containsInAnyOrder(HC_equalTo(@"um://viewa2")?? HC_equalTo(@"
um://viewa")??
HC_equalTo(@"um://viewb")?? nil));
GHAssertEqualStrings(config[@"um://viewa2"]?? @"ViewControllerA"??
@"config set error.");
}
|
????????8??AddConfig????
?????????????
??????????????????????????????????????????????????????????????
????????????????????????OCHamcrest???????????????????????????????HC_containsInAnyOrder???????У??????????????collection???????????????????????????????????????????????????????????????9????????????maches:describingMismatchTo:?????У??????????collection?????????????????????????б??????????????matches:??????matches:????????????collection?????е????????????????matchers??????????????matchers???????????????????????????????matchers???????????????matchers?????????????????collection???????????????У?matches:?????????????????????????????????NO?????????????
(BOOL)matches:(id)item
{
NSUInteger index = 0;
for (id matcher in matchers)
{
if ([matcher matches:item])
{
[matchers removeObjectAtIndex:index];
return YES;
}
++index;
}
[[mismatchDescription appendText:@"not matched: "] appendDescriptionOf:item];
return NO;
}
- (BOOL)matches:(id)collection describingMismatchTo:(id)
mismatchDescription
{
if (![collection conformsToProtocol:@protocol(NSFastEnumeration)])
{
[super describeMismatchOf:collection to:mismatchDescription];
return NO;
}
HCMatchingInAnyOrder *matchSequence =
[[HCMatchingInAnyOrder alloc] initWithMatchers:matchers
mismatchDescription:mismatchDescription];
for (id item in collection)
if (![matchSequence matches:item])
return NO;
return [matchSequence isFinishedWith:collection];
}
|
????????9??HC_containsInAnyOrder?????е????????????
?????????????????????????б??????????????????????????????????????matches:?????е???????????????б????????YES??
????????????????HCIsCollectionContainingInAnyOrder????????μ?????????HCIsCollectionHavingInAnyOrder???????????????HC_hasInAnyOrder????д????matches:??????matches:describingMismatchTo:??????????10???????μ????????????HCMatchingInAnyOrderEx???????????????matches:??????????11??????????????????????????ж????Collection???????????????????
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11