Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Jul 19, 2024
1 parent b2337c3 commit 34894e1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Sources/IssueReporting/Internal/SwiftTesting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func _recordIssue(
SourceLocation(fileID: fileID, _filePath: filePath, line: line, column: column)
)
#else
warn(
printError(
"""
\(fileID):\(line): An issue was recorded without linking the Testing framework.
Expand Down Expand Up @@ -112,7 +112,7 @@ func _withKnownIssue(
body
)
#else
warn(
printError(
"""
\(fileID):\(line): A known issue was recorded without linking the Testing framework.
Expand Down Expand Up @@ -142,7 +142,7 @@ func _currentTestIsNotNil() -> Bool {
#if DEBUG
return Test.current != nil
#else
warn(
printError(
"""
'Test.current' was accessed without linking the Testing framework.
Expand Down
3 changes: 2 additions & 1 deletion Sources/IssueReporting/Internal/Warn.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

func warn(_ message: String) {
@usableFromInline
func printError(_ message: String) {
#if os(Linux) || os(macOS)
fputs("\(message)\n", stderr)
#else
Expand Down
4 changes: 2 additions & 2 deletions Sources/IssueReporting/Internal/XCTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func _XCTFail(
return
}
#endif
warn(
printError(
"""
\(file):\(line): A failure was recorded without linking the XCTest framework.
Expand Down Expand Up @@ -92,7 +92,7 @@ func _XCTExpectFailure<R>(
return try result!._rethrowGet()
}
#else
warn(
printError(
"""
\(file):\(line): An expected failure was recorded without linking the XCTest framework.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
if message.isEmpty {
message = "Issue reported"
}
warn("\(fileID):\(line): \(message)")
printError("\(fileID):\(line): \(message)")
guard isDebuggerAttached else { return }
warn(
printError(
"""
Caught debug breakpoint. Type "continue" ("c") to resume execution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public struct RuntimeWarningReporter: IssueReporter {
"\(isTesting ? "\(fileID):\(line): " : "")\(message)"
)
#else
warn("\(fileID):\(line): \(message() ?? "")", stderr)
printError("\(fileID):\(line): \(message() ?? "")", stderr)
#endif
}

Expand Down

0 comments on commit 34894e1

Please sign in to comment.