Skip to content

Commit

Permalink
- Added experimental keyPath test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamztang committed Jul 31, 2012
1 parent 5bd2fd9 commit ef727fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions JTObjectMappingTests/JTObjectMappingTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ - (void)setUp

// This turns into an NSSet
[[NSSet setWithObjects:@"blue", @"green", nil] allObjects], @"favorite_colors",

// Setup hash for testing keypath
[NSDictionary dictionaryWithObject:@"string" forKey:@"string"], @"hashed",

@"1970-01-01T00:00:00+0000", @"create_date",

Expand Down Expand Up @@ -101,6 +104,9 @@ - (void)setUp
// set mapping
[NSSet mappingWithKey:@"favoriteColors"], @"favorite_colors",

// set keypath
@"hashedString", @"hashed.string",

// date mapping -- by format or since the epoch
[NSDate mappingWithKey:@"createDate"
dateFormatString:dateFormat], @"create_date",
Expand Down Expand Up @@ -207,6 +213,10 @@ - (void)testSet {
STAssertTrue([colors containsObject:@"blue"], @"%@ should contain 'blue'", colors);
}

- (void)testKeyPath {
STAssertEqualObjects(self.object.hashedString, @"string", nil, nil);
}

//- (void)testAutoMapping {
// STAssertEqualObjects(self.object.autoString, @"yes", nil, nil);
// NSArray *array = [NSArray arrayWithObjects:
Expand Down
2 changes: 2 additions & 0 deletions JTObjectMappingTests/JTUserTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
@property (nonatomic, retain) NSArray *users;
@property (nonatomic, retain) NSSet *favoriteColors;

@property (nonatomic, copy) NSString *hashedString;

@property (nonatomic, copy) NSString *autoString;
@property (nonatomic, retain) NSArray *autoArray;
@property (nonatomic, retain) NSArray *nestedArray;
Expand Down
2 changes: 1 addition & 1 deletion JTObjectMappingTests/JTUserTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ @implementation JTUserTest
@synthesize nestedArray;
@synthesize eighteenthBirthday;
@synthesize favoriteColors;

@synthesize hashedString;

@synthesize null, nullDate, nullArray, nullSet, nullChild, nullNumber;

Expand Down

0 comments on commit ef727fc

Please sign in to comment.