Skip to content

Commit

Permalink
Add a test for queries using an auto-migrated index
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed May 4, 2016
1 parent ade93d0 commit 6eb514d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Realm/Tests/MigrationTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,9 @@ + (NSArray *)requiredProperties {
return @[@"nonNullNonIndexed", @"nonNullIndexed"];
}

#if RLM_OLD_DATE_FORMAT
+ (NSArray *)indexedProperties {
return @[@"nonNullIndexed", @"nullIndexed"];
}
#endif
@end

@implementation MigrationTests
Expand Down Expand Up @@ -1078,6 +1076,23 @@ - (void)testDateTimeFormatAutoMigration {
XCTAssertNil(obj.nullIndexed);
XCTAssertEqual(obj.cookie, cookieValue);
}

for (NSDate *date in expectedDates) {
RLMResults *results = [DateMigrationObject objectsInRealm:realm
where:@"nonNullIndexed = %@ AND nullIndexed = %@",
date, date];
XCTAssertEqual(1U, results.count);
DateMigrationObject *obj = results.firstObject;
XCTAssertEqualObjects(date, obj.nonNullIndexed);
XCTAssertEqualObjects(date, obj.nullIndexed);

results = [DateMigrationObject objectsInRealm:realm
where:@"nonNullIndexed = %@ AND nullIndexed = nil", date];
XCTAssertEqual(1U, results.count);
obj = results.firstObject;
XCTAssertEqualObjects(date, obj.nonNullIndexed);
XCTAssertNil(obj.nullIndexed);
}
#endif
}

Expand Down

0 comments on commit 6eb514d

Please sign in to comment.