Skip to content

Commit 6073699

Browse files
Update documentation
1 parent bda93b1 commit 6073699

File tree

7 files changed

+40
-18
lines changed

7 files changed

+40
-18
lines changed

Sources/Mocking/Macros/Mocked.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
/// public final class DependencyMock: Dependency { ... }
1717
/// ```
1818
///
19-
/// - Parameter compilationCondition: The compilation condition to apply to the
20-
/// `#if` compiler directive used to wrap the generated mock.
21-
// TODO: Docs
19+
/// - Parameters:
20+
/// - compilationCondition: The compilation condition to apply to the
21+
/// `#if` compiler directive used to wrap the generated mock.
22+
/// (default: `.swiftMockingEnabled`)
23+
/// - sendableConformance: The `Sendable` conformance to apply to
24+
/// the generated mock. (default: `.checked`)
2225
@attached(peer, names: suffixed(Mock))
2326
public macro Mocked(
2427
compilationCondition: MockCompilationCondition = .swiftMockingEnabled,

Sources/Mocking/Models/MacroArguments/MockSendableConformance.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
// Copyright © 2025 Fetch.
55
//
66

7-
// TODO: Docs
7+
/// A `Sendable` conformance that can be applied to a mock declaration.
88
public enum MockSendableConformance {
99

10-
// TODO: Docs
10+
/// The mock adheres to the `Sendable` conformance of the original
11+
/// implementation.
1112
case checked
1213

13-
// TODO: Docs
14+
/// The mock conforms to `@unchecked Sendable`.
1415
case unchecked
1516
}

Sources/MockingMacros/Extensions/InheritedTypeSyntax/InheritedTypeSyntax+UncheckedSendable.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ import SwiftSyntax
88

99
extension InheritedTypeSyntax {
1010

11-
// TODO: Docs
12-
// @unchecked Sendable
11+
/// An `InheritedTypeSyntax` representing unchecked sendable conformance
12+
/// with a trailing comma.
13+
///
14+
/// ```swift
15+
/// // Represents
16+
/// @unchecked Sendable,
17+
/// ```
1318
static let uncheckedSendable = InheritedTypeSyntax(
1419
type: AttributedTypeSyntax(
1520
specifiers: [],

Sources/MockingMacros/Macros/MockedMacro/MockedMacro+MacroArguments.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension MockedMacro {
1919
/// The compilation condition with which to wrap the generated mock.
2020
let compilationCondition: MockCompilationCondition
2121

22-
// TODO: Docs
22+
/// The sendable conformance to apply to the generated mock.
2323
let sendableConformance: MockSendableConformance
2424

2525
// MARK: Initializers

Sources/MockingMacros/Macros/MockedMacro/MockedMacro.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,13 @@ extension MockedMacro {
178178
/// final class DependencyMock: Dependency {}
179179
/// ```
180180
///
181-
/// - Parameter protocolDeclaration: The protocol to which the mock must
182-
/// conform.
181+
/// - Parameters:
182+
/// - protocolDeclaration: The protocol to which the mock must
183+
/// conform.
184+
/// - sendableConformance: The sendable conformance the mock should have.
185+
/// If `.unchecked`, the clause will include `@unchecked Sendable`.
186+
///
183187
/// - Returns: The inheritance clause to apply to the mock declaration.
184-
// TODO: Docs
185188
private static func mockInheritanceClause(
186189
from protocolDeclaration: ProtocolDeclSyntax,
187190
sendableConformance: MockSendableConformance

Sources/MockingMacros/Models/MacroArguments/MacroArgument.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66

77
import SwiftSyntax
88

9-
// TODO: Docs
9+
/// A protocol for arguments that can be parsed from a macro's argument
10+
/// syntax.
1011
protocol MacroArgument {
12+
13+
/// Creates a macro argument from the provided `argument`.
14+
///
15+
/// - Parameter argument: The argument syntax from which to parse the
16+
/// macro argument.
1117
init?(argument: LabeledExprSyntax)
1218
}

Sources/MockingMacros/Models/MacroArguments/MockSendableConformance.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66

77
import SwiftSyntax
88

9-
// TODO: Docs
9+
/// A `Sendable` conformance that can be applied to a mock declaration.
1010
enum MockSendableConformance: String, MacroArgument {
1111

12-
// TODO: Docs
12+
/// The mock adheres to the `Sendable` conformance of the original
13+
/// implementation.
1314
case checked
1415

15-
// TODO: Docs
16+
/// The mock conforms to `@unchecked Sendable`.
1617
case unchecked
17-
18-
// TODO: Docs
18+
19+
/// Creates a sendable conformance from the provided `argument`.
20+
///
21+
/// - Parameter argument: The argument syntax from which to parse a
22+
/// sendable conformance.
1923
init?(argument: LabeledExprSyntax) {
2024
guard
2125
let memberAccessExpression = argument.expression.as(

0 commit comments

Comments
 (0)