Skip to content

Commit

Permalink
last fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
velicuvlad committed Nov 14, 2024
1 parent e8e5363 commit 2b1a872
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 21 deletions.
14 changes: 9 additions & 5 deletions Objective-C/CBLDocument.mm
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,16 @@ - (void) replaceC4Doc: (CBLC4Document*)c4doc {
}

- (nullable NSString*) _getRevisionHistory {
if (!_collection) {
return nil;
}

CBL_LOCK(self) {
if (!_c4Doc) {
return nil;
} else {
return sliceResult2string(c4doc_getRevisionHistory(_c4Doc.rawDoc, UINT_MAX, nil, 0));
}
C4Error err;
C4Document* doc = c4coll_getDoc(_collection.c4col, _c4Doc.docID, true, kDocGetAll, &err);
NSString* revHistory = doc ? sliceResult2string(c4doc_getRevisionHistory(doc, UINT_MAX, nil, 0)) : nil;
c4doc_release(doc);
return revHistory;
}
}

Expand Down
8 changes: 0 additions & 8 deletions Objective-C/Tests/DatabaseTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,6 @@ - (void) testSavePurgedDoc {

#pragma mark Save Conflict Handler

- (NSTimeInterval) checkTimestampUpdated:(CBLDocument*) doc
:(NSTimeInterval) oldTimestamp {
NSTimeInterval docTimestamp = doc.timestamp;
Assert(docTimestamp > oldTimestamp);

return docTimestamp;
}

- (void) testConflictHandler {
NSError* error;
NSString* docID = @"doc1";
Expand Down
5 changes: 2 additions & 3 deletions Objective-C/Tests/DocumentTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -2320,9 +2320,8 @@ - (void) testDocumentRevisionHistory {
Assert([defaultCollection saveDocument:doc error: &err]);
Assert(doc._getRevisionHistory);

// Fails from LiteCore,only 1 rev, no rev history
// doc = [[defaultCollection documentWithID: @"doc1" error: &err] toMutable];
// Assert(doc._getRevisionHistory);
doc = [[defaultCollection documentWithID: @"doc1" error: &err] toMutable];
Assert(doc._getRevisionHistory);
}

#pragma clang diagnostic pop
Expand Down
2 changes: 1 addition & 1 deletion Objective-C/Tests/VectorSearchTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ - (void) testVectorMatchLimitBoundary {

// Check if error thrown for wrong limit values
[self expectError: CBLErrorDomain code: CBLErrorInvalidQuery in: ^BOOL(NSError** err) {
NSString* sql = [self wordsQueryStringWithLimit: @10001];
NSString* sql = [self wordsQueryStringWithLimit: 10001];
return [self.wordDB createQuery: sql error: err] != nil;
}];
}
Expand Down
2 changes: 1 addition & 1 deletion Swift/Document.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class Document : DictionaryProtocol, Equatable, Hashable, Sequence {
return impl.revisionID
}

public var timestamp: Double {
public var timestamp: TimeInterval {
return impl.timestamp
}

Expand Down
5 changes: 2 additions & 3 deletions Swift/Tests/DocumentTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1901,8 +1901,7 @@ class DocumentTest: CBLTestCase {
try defaultCollection!.save(document: doc)
assert(doc._getRevisionHistory() != nil)

// Fails from LiteCore,only 1 rev, no rev history
// doc = try defaultCollection!.document(id: "doc1")!.toMutable();
// asser(doc._getRevisionHistory() != nil)
doc = try defaultCollection!.document(id: "doc1")!.toMutable();
assert(doc._getRevisionHistory() != nil)
}
}

0 comments on commit 2b1a872

Please sign in to comment.