Skip to content

Commit

Permalink
Merge pull request #2 from sushichop/FIX/assertion-test
Browse files Browse the repository at this point in the history
Fix assertion about `testCreatingError`
  • Loading branch information
sushichop authored Oct 19, 2020
2 parents 171db51 + e5dff2b commit 78d281a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions Tests/PuppyTests/FileLoggerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,17 @@ class FileLoggerTests: XCTestCase {
}
}

#if os(macOS)
#if !os(Linux)
func testCreatingError() throws {
let fileURLNotAbleToCreateDirectory = URL(fileURLWithPath: "../../foo/bar.log").absoluteURL // file:///foo/bar.log
let directoryURLNotAbleToCreateDirectory = URL(fileURLWithPath: "../../").absoluteURL
.appendingPathComponent("foo", isDirectory: true) // file:///file/foo/
let fileURLNotAbleToCreateDirectory = URL(fileURLWithPath: "/foo/bar.log").absoluteURL // file:///foo/bar.log
let directoryURLNotAbleToCreateDirectory = URL(fileURLWithPath: "/foo/").absoluteURL // file:///foo
XCTAssertThrowsError(try FileLogger("com.example.yourapp.filelogger.notcreatedirectory",
fileURL: fileURLNotAbleToCreateDirectory)) { error in
let error = error as? FileError
XCTAssertEqual(error, FileError.creatingDirectoryFailed(at: directoryURLNotAbleToCreateDirectory))
}

let fileURLNotAbleToCreateFile = URL(fileURLWithPath: "../foo.log").absoluteURL // file:///private/foo.log
let fileURLNotAbleToCreateFile = URL(fileURLWithPath: "/foo.log").absoluteURL // file:///foo.log
XCTAssertThrowsError(try FileLogger("com.example.yourapp.filelogger.notcreatefile",
fileURL: fileURLNotAbleToCreateFile)) { error in
let error = error as? FileError
Expand Down
9 changes: 4 additions & 5 deletions Tests/PuppyTests/FileRotationLoggerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,17 @@ class FileRotationLoggerTests: XCTestCase, FileRotationLoggerDeletate {
}
}

#if os(macOS)
#if !os(Linux)
func testCreatingError() throws {
let fileURLNotAbleToCreateDirectory = URL(fileURLWithPath: "../../foo-rotation/bar-rotation.log").absoluteURL // file:///foo-rotation/bar-rotation.log
let directoryURLNotAbleToCreateDirectory = URL(fileURLWithPath: "../../").absoluteURL
.appendingPathComponent("foo-rotation", isDirectory: true) // file:///file/foo-rotation/
let fileURLNotAbleToCreateDirectory = URL(fileURLWithPath: "/foo-rotation/bar-rotation.log").absoluteURL // file:///foo-rotation/bar-rotation.log
let directoryURLNotAbleToCreateDirectory = URL(fileURLWithPath: "/foo-rotation/").absoluteURL // file:///foo-rotation/
XCTAssertThrowsError(try FileRotationLogger("com.example.yourapp.filerotationlogger.notcreatedirectory",
fileURL: fileURLNotAbleToCreateDirectory)) { error in
let error = error as? FileError
XCTAssertEqual(error, FileError.creatingDirectoryFailed(at: directoryURLNotAbleToCreateDirectory))
}

let fileURLNotAbleToCreateFile = URL(fileURLWithPath: "../foo-rotation.log").absoluteURL // file:///private/foo-rotation.log
let fileURLNotAbleToCreateFile = URL(fileURLWithPath: "/foo-rotation.log").absoluteURL // file:///foo-rotation.log
XCTAssertThrowsError(try FileRotationLogger("com.example.yourapp.filerotationlogger.notcreatefile",
fileURL: fileURLNotAbleToCreateFile)) { error in
let error = error as? FileError
Expand Down

0 comments on commit 78d281a

Please sign in to comment.