diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-03-08 13:30:17 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-03-08 13:30:17 -0500 |
commit | eae878256164f6912c9243cc8d2e6d06965b8181 (patch) | |
tree | aea8cafee8c26ff819b36660e348c25f580bd534 /SmartDeviceLinkTests/LoggingSpecs | |
parent | 51c10aa28ee538a456594e991405a0b28219eff0 (diff) | |
download | sdl_ios-eae878256164f6912c9243cc8d2e6d06965b8181.tar.gz |
Rename some log configuration properties
Diffstat (limited to 'SmartDeviceLinkTests/LoggingSpecs')
3 files changed, 59 insertions, 24 deletions
diff --git a/SmartDeviceLinkTests/LoggingSpecs/SDLLogConfigurationSpec.m b/SmartDeviceLinkTests/LoggingSpecs/SDLLogConfigurationSpec.m index 0eba2bf3c..880e5b780 100644 --- a/SmartDeviceLinkTests/LoggingSpecs/SDLLogConfigurationSpec.m +++ b/SmartDeviceLinkTests/LoggingSpecs/SDLLogConfigurationSpec.m @@ -13,10 +13,10 @@ describe(@"a log configuration", ^{ it(@"should properly set default properties", ^{ testConfiguration = [SDLLogConfiguration defaultConfiguration]; - expect(testConfiguration.logModules).to(beEmpty()); - expect(testConfiguration.logFilters).to(beEmpty()); - expect(@(testConfiguration.logTargets.count)).to(equal(@1)); - expect([testConfiguration.logTargets anyObject].class).to(equal([SDLLogTargetASL class])); + expect(testConfiguration.modules).to(beEmpty()); + expect(testConfiguration.filters).to(beEmpty()); + expect(@(testConfiguration.targets.count)).to(equal(@1)); + expect([testConfiguration.targets anyObject].class).to(equal([SDLLogTargetASL class])); expect(@(testConfiguration.formatType)).to(equal(@(SDLLogFormatTypeDefault))); expect(@(testConfiguration.asynchronous)).to(equal(@YES)); expect(@(testConfiguration.errorsAsynchronous)).to(equal(@NO)); @@ -28,10 +28,10 @@ describe(@"a log configuration", ^{ it(@"should properly set debug properties", ^{ testConfiguration = [SDLLogConfiguration debugConfiguration]; - expect(testConfiguration.logModules).to(beEmpty()); - expect(testConfiguration.logFilters).to(beEmpty()); - expect(@(testConfiguration.logTargets.count)).to(equal(@1)); - expect([testConfiguration.logTargets anyObject].class).to(equal([SDLLogTargetASL class])); + expect(testConfiguration.modules).to(beEmpty()); + expect(testConfiguration.filters).to(beEmpty()); + expect(@(testConfiguration.targets.count)).to(equal(@1)); + expect([testConfiguration.targets anyObject].class).to(equal([SDLLogTargetASL class])); expect(@(testConfiguration.formatType)).to(equal(@(SDLLogFormatTypeDetailed))); expect(@(testConfiguration.asynchronous)).to(equal(@YES)); expect(@(testConfiguration.errorsAsynchronous)).to(equal(@NO)); diff --git a/SmartDeviceLinkTests/LoggingSpecs/SDLLogFilterSpec.m b/SmartDeviceLinkTests/LoggingSpecs/SDLLogFilterSpec.m index e5c659610..9e12d5e59 100644 --- a/SmartDeviceLinkTests/LoggingSpecs/SDLLogFilterSpec.m +++ b/SmartDeviceLinkTests/LoggingSpecs/SDLLogFilterSpec.m @@ -6,7 +6,7 @@ #import "SDLLogModel.h" -QuickSpecBegin(SDLLogFilterSpec) +QuickSpecBegin(SDLfilterspec) describe(@"a filter by a string", ^{ __block NSString *testFilterString = @"filter string"; diff --git a/SmartDeviceLinkTests/LoggingSpecs/SDLLogManagerSpec.m b/SmartDeviceLinkTests/LoggingSpecs/SDLLogManagerSpec.m index 361bc06fd..f8110383e 100644 --- a/SmartDeviceLinkTests/LoggingSpecs/SDLLogManagerSpec.m +++ b/SmartDeviceLinkTests/LoggingSpecs/SDLLogManagerSpec.m @@ -11,7 +11,7 @@ QuickSpecBegin(SDLLogManagerSpec) -describe(@"a log manager", ^{ +fdescribe(@"a log manager", ^{ __block SDLLogManager *testManager = nil; describe(@"when initializing", ^{ @@ -19,13 +19,15 @@ describe(@"a log manager", ^{ testManager = [[SDLLogManager alloc] init]; }); - expect(testManager.logModules).toNot(beNil()); - expect(testManager.logTargets).toNot(beNil()); - expect(testManager.logFilters).toNot(beNil()); - expect(@(testManager.asynchronous)).to(beFalsy()); - expect(@(testManager.errorsAsynchronous)).to(beFalsy()); - expect(@(testManager.globalLogLevel)).to(equal(@(SDLLogLevelError))); - expect(@(testManager.formatType)).to(equal(@(SDLLogFormatTypeDefault))); + it(@"should properly initialize properties", ^{ + expect(testManager.modules).toNot(beNil()); + expect(testManager.targets).toNot(beNil()); + expect(testManager.filters).toNot(beNil()); + expect(@(testManager.asynchronous)).to(beTruthy()); + expect(@(testManager.errorsAsynchronous)).to(beFalsy()); + expect(@(testManager.globalLogLevel)).to(equal(@(SDLLogLevelError))); + expect(@(testManager.formatType)).to(equal(@(SDLLogFormatTypeDefault))); + }); }); describe(@"after setting a configuration", ^{ @@ -37,18 +39,18 @@ describe(@"a log manager", ^{ testLogTarget = [TestLogTarget logger]; testConfiguration = [SDLLogConfiguration debugConfiguration]; - testConfiguration.logModules = [NSSet setWithObject:[SDLLogFileModule moduleWithName:@"test" files:[NSSet setWithObject:@"test"]]]; - testConfiguration.logFilters = [NSSet setWithObject:[SDLLogFilter filterByAllowingString:@"test" caseSensitive:NO]]; - testConfiguration.logTargets = [NSSet setWithObject:testLogTarget]; - testConfiguration.logTargets = [NSSet setWithObject:[TestLogTarget logger]]; + testConfiguration.modules = [NSSet setWithObject:[SDLLogFileModule moduleWithName:@"test" files:[NSSet setWithObject:@"test"]]]; + testConfiguration.filters = [NSSet setWithObject:[SDLLogFilter filterByAllowingString:@"test" caseSensitive:NO]]; + testConfiguration.targets = [NSSet setWithObject:testLogTarget]; + testConfiguration.asynchronous = NO; [testManager setConfiguration:testConfiguration]; }); it(@"should properly set the configuration", ^{ - expect(testManager.logModules).to(equal(testConfiguration.logModules)); - expect(testManager.logFilters).to(equal(testConfiguration.logFilters)); - expect(testManager.logTargets).to(equal(testConfiguration.logTargets)); + expect(testManager.modules).to(equal(testConfiguration.modules)); + expect(testManager.filters).to(equal(testConfiguration.filters)); + expect(testManager.targets).to(equal(testConfiguration.targets)); expect(@(testManager.asynchronous)).to(equal(@(testConfiguration.asynchronous))); expect(@(testManager.errorsAsynchronous)).to(equal(@(testConfiguration.errorsAsynchronous))); expect(@(testManager.globalLogLevel)).to(equal(@(SDLLogLevelDebug))); @@ -66,6 +68,39 @@ describe(@"a log manager", ^{ expect(testLogTarget.loggedMessages.firstObject.message).to(equal(testMessage)); }); + + context(@"a simple formatted log", ^{ + beforeEach(^{ + testConfiguration.formatType = SDLLogFormatTypeSimple; + [testManager setConfiguration:testConfiguration]; + }); + + it(@"should properly log the formatted message", ^{ + expect(testLogTarget.formattedLogMessages.firstObject).to(match(@" ")); + }); + }); + + context(@"a default formatted log", ^{ + beforeEach(^{ + testConfiguration.formatType = SDLLogFormatTypeDefault; + [testManager setConfiguration:testConfiguration]; + }); + + it(@"should properly log the formatted message", ^{ + expect(testLogTarget.formattedLogMessages.firstObject).to(match(@" ")); + }); + }); + + context(@"a detailed formatted log", ^{ + beforeEach(^{ + testConfiguration.formatType = SDLLogFormatTypeDetailed; + [testManager setConfiguration:testConfiguration]; + }); + + it(@"should properly log the formatted message", ^{ + expect(testLogTarget.formattedLogMessages.firstObject).to(match(@" ")); + }); + }); }); }); |