-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added constant registration and fixed ending and canceling objects re…
…gistrations.
- Loading branch information
Showing
14 changed files
with
483 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// ConstantInfoTests.m | ||
// appledoc | ||
// | ||
// Created by Tomaž Kragelj on 4/20/12. | ||
// Copyright (c) 2012 Tomaz Kragelj. All rights reserved. | ||
// | ||
|
||
#import "Store.h" | ||
#import "TestCaseBase.h" | ||
|
||
@interface ConstantInfoTests : TestCaseBase | ||
@end | ||
|
||
@interface ConstantInfoTests (CreationMethods) | ||
- (void)runWithConstantInfo:(void(^)(ConstantInfo *info))handler; | ||
@end | ||
|
||
@implementation ConstantInfoTests | ||
|
||
#pragma mark - Verify lazy initialization | ||
|
||
- (void)testLazyInitializersWork { | ||
[self runWithConstantInfo:^(ConstantInfo *info) { | ||
// execute & verify | ||
assertThat(info.constantTypes, instanceOf([TypeInfo class])); | ||
}]; | ||
} | ||
|
||
|
||
#pragma mark - beginConstantTypes | ||
|
||
- (void)testBeginConstantTypesShouldChangeCurrentRegistrationObjectToTypes { | ||
[self runWithConstantInfo:^(ConstantInfo *info) { | ||
// setup | ||
id mock = [OCMockObject mockForClass:[Store class]]; | ||
[[mock expect] pushRegistrationObject:[OCMArg checkWithBlock:^BOOL(id obj) { | ||
return [obj isKindOfClass:[TypeInfo class]]; | ||
}]]; | ||
info.objectRegistrar = mock; | ||
// execute | ||
[info beginConstantTypes]; | ||
// verify | ||
STAssertNoThrow([mock verify], nil); | ||
}]; | ||
} | ||
|
||
#pragma mark - appendConstantName: | ||
|
||
- (void)testAppendConstantNameShouldAssignGivenString { | ||
[self runWithConstantInfo:^(ConstantInfo *info) { | ||
// execute | ||
[info appendConstantName:@"value"]; | ||
// verify | ||
assertThat(info.constantName, equalTo(@"value")); | ||
}]; | ||
} | ||
|
||
@end | ||
|
||
#pragma mark - | ||
|
||
@implementation ConstantInfoTests (CreationMethods) | ||
|
||
- (void)runWithConstantInfo:(void(^)(ConstantInfo *info))handler { | ||
ConstantInfo *info = [ConstantInfo new]; | ||
handler(info); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.