mirror of
https://github.com/wnagrodzki/SwiftLogger.git
synced 2025-04-08 13:31:50 +02:00
Added LogStringConvertibleTests
This commit is contained in:
parent
3a6c531dad
commit
f032da4ed8
2 changed files with 54 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2E58D35D21316C3500BEF81A /* LogStringConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E58D35C21316C3500BEF81A /* LogStringConvertibleTests.swift */; };
|
||||
2E58D35F21316C3500BEF81A /* libLogger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EBF4B3A2122AA34008E4117 /* libLogger.a */; };
|
||||
2EBF4B3E2122AA34008E4117 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EBF4B3D2122AA34008E4117 /* Logger.swift */; };
|
||||
2EBF4B452122ACD6008E4117 /* LogStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EBF4B442122ACD6008E4117 /* LogStringConvertible.swift */; };
|
||||
|
@ -43,6 +44,7 @@
|
|||
|
||||
/* Begin PBXFileReference section */
|
||||
2E58D35A21316C3500BEF81A /* UnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2E58D35C21316C3500BEF81A /* LogStringConvertibleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogStringConvertibleTests.swift; sourceTree = "<group>"; };
|
||||
2E58D35E21316C3500BEF81A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
2EBF4B3A2122AA34008E4117 /* libLogger.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLogger.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2EBF4B3D2122AA34008E4117 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
|
||||
|
@ -80,6 +82,7 @@
|
|||
2E58D35B21316C3500BEF81A /* UnitTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2E58D35C21316C3500BEF81A /* LogStringConvertibleTests.swift */,
|
||||
2E58D35E21316C3500BEF81A /* Info.plist */,
|
||||
);
|
||||
path = UnitTests;
|
||||
|
@ -227,6 +230,7 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2E58D35D21316C3500BEF81A /* LogStringConvertibleTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
50
UnitTests/LogStringConvertibleTests.swift
Normal file
50
UnitTests/LogStringConvertibleTests.swift
Normal file
|
@ -0,0 +1,50 @@
|
|||
//
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2018 Wojciech Nagrodzki
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import Logger
|
||||
|
||||
class LogStringConvertibleTests: XCTestCase {
|
||||
|
||||
func testZeroObjectsDescription() {
|
||||
let objects = [Int]()
|
||||
XCTAssertEqual(objects.logDescription, "[]")
|
||||
}
|
||||
|
||||
func testOneObjectDescription() {
|
||||
let objects = [1]
|
||||
XCTAssertEqual(objects.logDescription, "[1]")
|
||||
}
|
||||
|
||||
func testTwoObjectsDescription() {
|
||||
let objects = [1, 2]
|
||||
XCTAssertEqual(objects.logDescription, "[1, 2]")
|
||||
}
|
||||
}
|
||||
|
||||
extension Int: LogStringConvertible {
|
||||
public var logDescription: String {
|
||||
return String(describing: self)
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue