Skip to content

Commit

Permalink
forward #file to #filePath differently (#137)
Browse files Browse the repository at this point in the history
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
  • Loading branch information
weissi authored Jun 22, 2020
1 parent ee8b3c5 commit afc50b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Tests/LoggingTests/LoggingTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class LoggingTest: XCTestCase {
"lazy": .stringConvertible(LazyMetadataBox { "rendered-at-first-use" })])
}

private func dontEvaluateThisString(file: StaticString = (#file), line: UInt = #line) -> Logger.Message {
XCTFail("should not have been evaluated", file: file, line: line)
private func dontEvaluateThisString(file: StaticString = #file, line: UInt = #line) -> Logger.Message {
XCTFail("should not have been evaluated", file: (file), line: line)
return "should not have been evaluated"
}

Expand Down
10 changes: 6 additions & 4 deletions Tests/LoggingTests/TestLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,21 @@ extension History {
func assertExist(level: Logger.Level,
message: String,
metadata: Logger.Metadata? = nil,
file: StaticString = (#file),
file: StaticString = #file,
line: UInt = #line) {
let entry = self.find(level: level, message: message, metadata: metadata)
XCTAssertNotNil(entry, "entry not found: \(level), \(String(describing: metadata)), \(message) ", file: file, line: line)
XCTAssertNotNil(entry, "entry not found: \(level), \(String(describing: metadata)), \(message) ",
file: (file), line: line)
}

func assertNotExist(level: Logger.Level,
message: String,
metadata: Logger.Metadata? = nil,
file: StaticString = (#file),
file: StaticString = #file,
line: UInt = #line) {
let entry = self.find(level: level, message: message, metadata: metadata)
XCTAssertNil(entry, "entry was found: \(level), \(String(describing: metadata)), \(message)", file: file, line: line)
XCTAssertNil(entry, "entry was found: \(level), \(String(describing: metadata)), \(message)",
file: (file), line: line)
}

func find(level: Logger.Level, message: String, metadata: Logger.Metadata? = nil) -> LogEntry? {
Expand Down

0 comments on commit afc50b2

Please sign in to comment.