Skip to content

Commit

Permalink
[1.0.7] fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shial4 committed Jul 3, 2018
1 parent 48e56ec commit 82467b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/SLLog/SLLogFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public class SLLogFile {
queue.addOperation { [weak self] in
guard let path = self?.filePath else { return }
if FileManager.default.fileExists(atPath: path),
let data = "\n{%beging:log%}\(log){%end:log%}".data(using: .utf8) {
let data = "\n{%beging:log%}\(log)".data(using: .utf8) {
if self?.fileHandle == nil {
self?.fileHandle = FileHandle(forWritingAtPath: path)
}
_ = self?.fileHandle?.seekToEndOfFile()
self?.fileHandle?.write(data)
} else if let _ = try? "{%beging:log%}\(log){%end:log%}".write(toFile: path, atomically: true, encoding: .utf8) {
} else if let _ = try? "{%beging:log%}\(log)".write(toFile: path, atomically: true, encoding: .utf8) {
if let file = path.components(separatedBy: "/").last {
self?.files.append(file)
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/SLLogTests/SLLogFileTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class SLLogFileTests: XCTestCase {
let data = fileHandle.readDataToEndOfFile()
fileHandle.closeFile()
if let content = String(data: data, encoding: .utf8),
content.components(separatedBy: " ").last == "#%^$&@}" {
content.components(separatedBy: " ").last == "#%^$&@" {
exp.fulfill()
} else {
XCTFail("incorrect message value")
Expand Down

0 comments on commit 82467b3

Please sign in to comment.