diff --git a/Sources/IssueReporting/Internal/SwiftTesting.swift b/Sources/IssueReporting/Internal/SwiftTesting.swift index 2497068..c43b2f9 100644 --- a/Sources/IssueReporting/Internal/SwiftTesting.swift +++ b/Sources/IssueReporting/Internal/SwiftTesting.swift @@ -234,19 +234,17 @@ func _withKnownIssue( await withKnownIssue(message, isIntermittent, fileID, filePath, line, column, body) } @usableFromInline -func _currentTestData() -> (id: AnyHashable, isParameterized: Bool)? { - guard let function = function(for: "$s25IssueReportingTestSupport08_currentC4DataypyF") +func _currentTestID() -> AnyHashable? { + guard let function = function(for: "$s25IssueReportingTestSupport08_currentC2IDypyF") else { #if DEBUG - guard let id = Test.current?.id, let isParameterized = Test.Case.current?.isParameterized - else { return nil } - return (id, isParameterized) + return Test.current?.id #else return nil #endif } - return (function as! @Sendable () -> (id: AnyHashable, isParameterized: Bool)?)() + return (function as! @Sendable () -> AnyHashable?)() } #if DEBUG @@ -354,8 +352,8 @@ func _currentTestData() -> (id: AnyHashable, isParameterized: Bool)? { } } - private struct Test: @unchecked Sendable { - fileprivate static var current: Self? { + struct Test: @unchecked Sendable { + static var current: Self? { guard let current = unsafeBitCast( symbol: "$s7Testing4TestV7currentACSgvgZ", @@ -366,30 +364,7 @@ func _currentTestData() -> (id: AnyHashable, isParameterized: Bool)? { return current() } - fileprivate struct Case { - static var current: Self? { - guard - let current = unsafeBitCast( - symbol: "$s7Testing4TestV4CaseV7currentAESgvgZ", - in: "Testing", - to: (@convention(thin) () -> Test.Case?).self - ) - else { return nil } - return current() - } - - private var arguments: [Argument] - private var body: @Sendable () async throws -> Void - - fileprivate var isParameterized: Bool { - !arguments.isEmpty - } - - private struct Argument: Sendable { - var value: any Sendable - var parameter: Parameter - } - } + struct Case {} private var name: String private var displayName: String? private var traits: [any Trait] diff --git a/Sources/IssueReporting/TestContext.swift b/Sources/IssueReporting/TestContext.swift index 53a45cc..15ce8ce 100644 --- a/Sources/IssueReporting/TestContext.swift +++ b/Sources/IssueReporting/TestContext.swift @@ -23,8 +23,8 @@ public enum TestContext: Equatable { /// If executed outside of a test process, this will return `nil`. public static var current: Self? { guard isTesting else { return nil } - if case let (id, isParameterized)? = _currentTestData() { - return .swiftTesting(Testing(id: id, isParameterized: isParameterized)) + if let currentTestID = _currentTestID() { + return .swiftTesting(Testing(id: currentTestID)) } else { return .xcTest } @@ -42,11 +42,7 @@ public enum TestContext: Equatable { public struct Test: Equatable, Hashable, Identifiable, Sendable { public let id: ID - public let `case`: Test.Case - public struct Case: Equatable, Hashable, Sendable { - public let isParameterized: Bool - } public struct ID: Equatable, Hashable, @unchecked Sendable { fileprivate let rawValue: AnyHashable } @@ -77,12 +73,7 @@ public enum TestContext: Equatable { } extension TestContext.Testing { - fileprivate init(id: AnyHashable, isParameterized: Bool) { - self.init( - test: Test( - id: Test.ID(rawValue: id), - case: Test.Case(isParameterized: isParameterized) - ) - ) + fileprivate init(id: AnyHashable) { + self.init(test: Test(id: Test.ID(rawValue: id))) } } diff --git a/Sources/IssueReportingTestSupport/SwiftTesting.swift b/Sources/IssueReportingTestSupport/SwiftTesting.swift index 93f6e1d..e59b6ed 100644 --- a/Sources/IssueReportingTestSupport/SwiftTesting.swift +++ b/Sources/IssueReportingTestSupport/SwiftTesting.swift @@ -100,13 +100,11 @@ private func __withKnownIssueAsync( #endif } -public func _currentTestData() -> Any { __currentTestData } +public func _currentTestID() -> Any { __currentTestID } @Sendable -private func __currentTestData() -> (id: AnyHashable, isParameterized: Bool)? { +private func __currentTestID() -> AnyHashable? { #if canImport(Testing) - guard let id = Test.current?.id, let isParameterized = Test.Case.current?.isParameterized - else { return nil } - return (id, isParameterized) + return Test.current?.id #else return nil #endif