Skip to content

Commit

Permalink
removed unused method and 1 redundant test
Browse files Browse the repository at this point in the history
  • Loading branch information
velicuvlad committed Jan 22, 2025
1 parent b622e68 commit b551f08
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions Objective-C/Tests/LogTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,6 @@ - (void) writeAllLogs: (NSString*)string {
CBLWarnError(Database, @"%@", string);
}

- (BOOL) isKeywordPresentInAnyLog: (NSString*)keyword path: (nullable NSString*)path {
if (!path) return NO;
NSArray* files = [self getLogsInDirectory: path properties: nil onlyInfoLogs: NO];
NSError* error;
for (NSURL* url in files) {
NSString* contents = [NSString stringWithContentsOfURL: url
encoding: NSASCIIStringEncoding
error: &error];
AssertNil(error);
if ([contents rangeOfString: keyword].location != NSNotFound) {
return YES;
}
}
return NO;
}

- (void) testCustomLoggingLevels {
CBLLogInfo(Database, @"IGNORE");
CustomLogger* customLogger = [[CustomLogger alloc] init];
Expand Down Expand Up @@ -282,22 +266,14 @@ - (void) testFileLoggingMaxSize {
AssertEqual(files.count, totalFilesShouldBeInDirectory);
}

- (void) testFileLoggingDisabled {
CBLLogSinks.file = nil;

NSString* inputString = [[NSUUID UUID] UUIDString];
[self writeAllLogs: inputString];

AssertFalse([self isKeywordPresentInAnyLog: inputString path: CBLLogSinks.file.directory]);
}

- (void) testFileLoggingReEnableLogging {
CBLLogSinks.file = nil;
AssertNil(CBLLogSinks.file.directory);

NSString* inputString = [[NSUUID UUID] UUIDString];
[self writeAllLogs: inputString];

AssertFalse([self isKeywordPresentInAnyLog: inputString path: CBLLogSinks.file.directory]);
AssertNil(CBLLogSinks.file.directory);

CBLLogSinks.file = [[CBLFileLogSink alloc] initWithLevel: kCBLLogLevelVerbose
directory: logFileDirectory
Expand Down

0 comments on commit b551f08

Please sign in to comment.