From 4fc4d43e054f046b90876f5d47b7e393ac4c595e Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Wed, 7 May 2025 10:16:37 -0500 Subject: [PATCH 1/3] Fix empty message crash. --- .../SwiftTesting.swift | 1 + .../SwiftTestingTests.swift | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Sources/IssueReportingTestSupport/SwiftTesting.swift b/Sources/IssueReportingTestSupport/SwiftTesting.swift index 0107ed4..7ca6b94 100644 --- a/Sources/IssueReportingTestSupport/SwiftTesting.swift +++ b/Sources/IssueReportingTestSupport/SwiftTesting.swift @@ -14,6 +14,7 @@ private func __recordIssue( column: Int ) { #if canImport(Testing) + let message = message == "" ? nil : message Issue.record( message.map(Comment.init(rawValue:)), sourceLocation: SourceLocation( diff --git a/Tests/IssueReportingTests/SwiftTestingTests.swift b/Tests/IssueReportingTests/SwiftTestingTests.swift index 3969ac6..c88c1ac 100644 --- a/Tests/IssueReportingTests/SwiftTestingTests.swift +++ b/Tests/IssueReportingTests/SwiftTestingTests.swift @@ -129,6 +129,34 @@ && issue.description == "Issue recorded: Something went wrong" } } + + @Test + func emptyMessage() { + withKnownIssue { + reportIssue("") + } + } + + @Test + func emptyMessage_async() async { + withKnownIssue { + reportIssue("") + } + } + + @Test + func emptyMessage_throws() throws { + withKnownIssue { + reportIssue("") + } + } + + @Test + func emptyMessage_asyncThrows() async throws { + withKnownIssue { + reportIssue("") + } + } } private struct Failure: Error {} From 766ed4729e50421e0771729c7e4003775bda90cb Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Wed, 7 May 2025 10:57:49 -0500 Subject: [PATCH 2/3] wip --- Tests/IssueReportingTests/SwiftTestingTests.swift | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Tests/IssueReportingTests/SwiftTestingTests.swift b/Tests/IssueReportingTests/SwiftTestingTests.swift index c88c1ac..9187897 100644 --- a/Tests/IssueReportingTests/SwiftTestingTests.swift +++ b/Tests/IssueReportingTests/SwiftTestingTests.swift @@ -133,27 +133,29 @@ @Test func emptyMessage() { withKnownIssue { - reportIssue("") + reportIssue("hey") } } @Test func emptyMessage_async() async { - withKnownIssue { - reportIssue("") + await withKnownIssue { + await Task.yield() + reportIssue("hey") } } @Test func emptyMessage_throws() throws { withKnownIssue { - reportIssue("") + reportIssue("hey") } } @Test func emptyMessage_asyncThrows() async throws { - withKnownIssue { + await withKnownIssue { + await Task.yield() reportIssue("") } } From 469c09ddbfaed41dfc2ccb87cd803c39953ca918 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Wed, 7 May 2025 10:58:01 -0500 Subject: [PATCH 3/3] wip --- Tests/IssueReportingTests/SwiftTestingTests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/IssueReportingTests/SwiftTestingTests.swift b/Tests/IssueReportingTests/SwiftTestingTests.swift index 9187897..68a3f09 100644 --- a/Tests/IssueReportingTests/SwiftTestingTests.swift +++ b/Tests/IssueReportingTests/SwiftTestingTests.swift @@ -133,7 +133,7 @@ @Test func emptyMessage() { withKnownIssue { - reportIssue("hey") + reportIssue("") } } @@ -141,14 +141,14 @@ func emptyMessage_async() async { await withKnownIssue { await Task.yield() - reportIssue("hey") + reportIssue("") } } @Test func emptyMessage_throws() throws { withKnownIssue { - reportIssue("hey") + reportIssue("") } }