diff --git a/Sources/TestingMacros/TestDeclarationMacro.swift b/Sources/TestingMacros/TestDeclarationMacro.swift index 58e8259ec..50ac690d2 100644 --- a/Sources/TestingMacros/TestDeclarationMacro.swift +++ b/Sources/TestingMacros/TestDeclarationMacro.swift @@ -160,6 +160,8 @@ public struct TestDeclarationMacro: PeerMacro, Sendable { for (label, parameter) in parametersWithLabels { if parameter.firstName.tokenKind == .wildcard { LabeledExprSyntax(expression: label) + } else if let rawIdentifier = parameter.firstName.rawIdentifier { + LabeledExprSyntax(label: "`\(rawIdentifier)`", expression: label) } else { LabeledExprSyntax(label: parameter.firstName.textWithoutBackticks, expression: label) } diff --git a/Tests/TestingTests/MiscellaneousTests.swift b/Tests/TestingTests/MiscellaneousTests.swift index b895f6c1b..6a65fb658 100644 --- a/Tests/TestingTests/MiscellaneousTests.swift +++ b/Tests/TestingTests/MiscellaneousTests.swift @@ -315,6 +315,11 @@ struct MiscellaneousTests { let displayName = try #require(suite.displayName) #expect(displayName == "Suite With De Facto Display Name") } + + @Test(arguments: [0]) + func `Test with raw identifier and raw identifier parameter labels can compile`(`argument name` i: Int) { + #expect(i == 0) + } #endif @Test("Free functions are runnable")