This repository has been archived by the owner on Aug 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tic and toc global aliases and tests
- Loading branch information
Showing
7 changed files
with
244 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
Evergreen.xcodeproj/xcshareddata/xcschemes/Evergreen.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0710" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "87539B1E19DB23F00084658D" | ||
BuildableName = "Evergreen.framework" | ||
BlueprintName = "Evergreen" | ||
ReferencedContainer = "container:Evergreen.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "87539B2919DB23F00084658D" | ||
BuildableName = "EvergreenTests.xctest" | ||
BlueprintName = "EvergreenTests" | ||
ReferencedContainer = "container:Evergreen.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "87539B1E19DB23F00084658D" | ||
BuildableName = "Evergreen.framework" | ||
BlueprintName = "Evergreen" | ||
ReferencedContainer = "container:Evergreen.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "87539B1E19DB23F00084658D" | ||
BuildableName = "Evergreen.framework" | ||
BlueprintName = "Evergreen" | ||
ReferencedContainer = "container:Evergreen.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "87539B1E19DB23F00084658D" | ||
BuildableName = "Evergreen.framework" | ||
BlueprintName = "Evergreen" | ||
ReferencedContainer = "container:Evergreen.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// LoggingTests.swift | ||
// Evergreen | ||
// | ||
// Created by Nils Fischer on 04.04.16. | ||
// Copyright © 2016 viWiD Webdesign & iOS Development. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import Evergreen | ||
|
||
|
||
class LoggingTests: StenographyTestCase { | ||
|
||
|
||
func testLogLevels() { | ||
var expectedRecordCount = 0 | ||
let message = "message" | ||
log(message) | ||
expectedRecordCount = records.count // there may be application info logged at the beginning | ||
XCTAssertEqual(records.count, expectedRecordCount, "The expected record \(expectedRecordCount) count does not match the number of logged records \(records.count): \(records)") | ||
XCTAssert(records[expectedRecordCount - 1].description.containsString(message)) | ||
// undefined | ||
log(message) | ||
expectedRecordCount += 1 | ||
XCTAssertEqual(records.count, expectedRecordCount, "The expected record \(expectedRecordCount) count does not match the number of logged records \(records.count): \(records)") | ||
Evergreen.logLevel = .Debug | ||
log(message, forLevel: .Verbose) | ||
XCTAssertEqual(records.count, expectedRecordCount, "The expected record \(expectedRecordCount) count does not match the number of logged records \(records.count): \(records)") | ||
log(message, forLevel: .Debug) | ||
expectedRecordCount += 1 | ||
XCTAssertEqual(records.count, expectedRecordCount, "The expected record \(expectedRecordCount) count does not match the number of logged records \(records.count): \(records)") | ||
log(message, forLevel: .Info) | ||
expectedRecordCount += 1 | ||
XCTAssertEqual(records.count, expectedRecordCount, "The expected record \(expectedRecordCount) count does not match the number of logged records \(records.count): \(records)") | ||
} | ||
|
||
func testErrorLogging() { | ||
enum TestError: ErrorType, CustomStringConvertible, CustomDebugStringConvertible { | ||
case Failure | ||
var debugDescription: String { return "custom_debug_description" } | ||
var description: String { return "custom_description"} | ||
} | ||
let error = TestError.Failure | ||
Evergreen.log("Something failed", error: error) | ||
XCTAssert(records.count == 1) | ||
XCTAssert(records[0].description.containsString("custom_debug_description"), "Logged error does not contain the error's debug description, which should be prioritized over its description.") | ||
} | ||
|
||
func testTimeLogging() { | ||
let message = "message" | ||
tic(andLog: message) | ||
var expectedRecordCount = records.count // there may be application info logged at the beginning | ||
XCTAssertEqual(records.count, expectedRecordCount, "The expected record \(expectedRecordCount) count does not match the number of logged records \(records.count): \(records)") | ||
XCTAssert(records[expectedRecordCount - 1].description.containsString(message)) | ||
toc(andLog: message) | ||
expectedRecordCount += 1 | ||
XCTAssertEqual(records.count, expectedRecordCount, "The expected record \(expectedRecordCount) count does not match the number of logged records \(records.count): \(records)") | ||
XCTAssert(records[expectedRecordCount - 1].description.containsString(message)) | ||
XCTAssert(records[expectedRecordCount - 1].description.containsString("TIME")) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// StenographyHandlerTestCase.swift | ||
// Evergreen | ||
// | ||
// Created by Nils Fischer on 04.04.16. | ||
// Copyright © 2016 viWiD Webdesign & iOS Development. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
import Evergreen | ||
|
||
|
||
class StenographyTestCase: XCTestCase { | ||
|
||
var stenographyHandler: StenographyHandler! | ||
var records: [Record] { | ||
return stenographyHandler.records | ||
} | ||
|
||
override func setUp() { | ||
super.setUp() | ||
stenographyHandler = StenographyHandler() | ||
Evergreen.defaultLogger.handlers = [ stenographyHandler ] | ||
} | ||
|
||
} |