Skip to content

Commit

Permalink
fix: support sendable conformance
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolos65 committed Jun 24, 2024
1 parent 73a312e commit 956861a
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Sources/Mockable/Mocker/Mocker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Combine
///
/// The `Mocker` class keeps track of invocations, expected return values, and actions associated with
/// specific members of a mockable service.
public class Mocker<Service: MockableService> {
public class Mocker<Service: MockableService>: @unchecked Sendable {

// MARK: Public Properties

Expand Down
2 changes: 1 addition & 1 deletion Sources/MockableMacro/Factory/MemberFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension MemberFactory {
private static func mocker(_ requirements: Requirements) -> VariableDeclSyntax {
VariableDeclSyntax(
modifiers: [DeclModifierSyntax(name: .keyword(.private))],
bindingSpecifier: .keyword(.var)
bindingSpecifier: .keyword(.let)
) {
PatternBindingSyntax(
pattern: IdentifierPatternSyntax(identifier: NS.mocker),
Expand Down
2 changes: 1 addition & 1 deletion Tests/MockableMacroTests/AccessModifierTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class AccessModifierTests: MockableMacroTestCase {
#if MOCKING
private final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
6 changes: 3 additions & 3 deletions Tests/MockableMacroTests/AssociatedTypeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class AssociatedTypeTests: MockableMacroTestCase {
#if MOCKING
final class MockTest<Item>: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -117,7 +117,7 @@ final class AssociatedTypeTests: MockableMacroTestCase {
#if MOCKING
final class MockTest<Item>: Test, MockableService where Item: Equatable, Item: Hashable {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -207,7 +207,7 @@ final class AssociatedTypeTests: MockableMacroTestCase {
#if MOCKING
final class MockTest<Item>: Test, MockableService where Item: Equatable, Item: Hashable {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
2 changes: 1 addition & 1 deletion Tests/MockableMacroTests/AttributesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class AttributesTests: MockableMacroTestCase {
#if MOCKING
final class MockAttributeTest: AttributeTest, MockableService {
private var mocker = Mocker<MockAttributeTest>()
private let mocker = Mocker<MockAttributeTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
6 changes: 3 additions & 3 deletions Tests/MockableMacroTests/ExoticParameterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ExoticParameterTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -113,7 +113,7 @@ final class ExoticParameterTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -201,7 +201,7 @@ final class ExoticParameterTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
6 changes: 3 additions & 3 deletions Tests/MockableMacroTests/FunctionEffectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class FunctionEffectTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -137,7 +137,7 @@ final class FunctionEffectTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -229,7 +229,7 @@ final class FunctionEffectTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
6 changes: 3 additions & 3 deletions Tests/MockableMacroTests/GenericFunctionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class GenericFunctionTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -113,7 +113,7 @@ final class GenericFunctionTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -205,7 +205,7 @@ final class GenericFunctionTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
4 changes: 2 additions & 2 deletions Tests/MockableMacroTests/InitRequirementTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class InitRequirementTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -104,7 +104,7 @@ final class InitRequirementTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
6 changes: 3 additions & 3 deletions Tests/MockableMacroTests/NameCollisionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class NameCollisionTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -138,7 +138,7 @@ final class NameCollisionTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -247,7 +247,7 @@ final class NameCollisionTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
6 changes: 3 additions & 3 deletions Tests/MockableMacroTests/PropertyRequirementTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class PropertyRequirementTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -142,7 +142,7 @@ final class PropertyRequirementTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down Expand Up @@ -275,7 +275,7 @@ final class PropertyRequirementTests: MockableMacroTestCase {
#if MOCKING
final class MockTest: Test, MockableService {
private var mocker = Mocker<MockTest>()
private let mocker = Mocker<MockTest>()
@available(*, deprecated, message: "Use given(_ service:) of Mockable instead. ")
func given() -> ReturnBuilder {
.init(mocker: mocker)
Expand Down
2 changes: 1 addition & 1 deletion Tests/MockableTests/Protocols/TestProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import MockableTest

@Mockable
protocol TestProtocol where Item2: Identifiable {
protocol TestProtocol: Sendable where Item2: Identifiable {

// MARK: Associated Types

Expand Down

0 comments on commit 956861a

Please sign in to comment.