Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associatedtype not parsing to mock #1333

Open
SeRG1k17 opened this issue May 17, 2024 · 0 comments
Open

Associatedtype not parsing to mock #1333

SeRG1k17 opened this issue May 17, 2024 · 0 comments

Comments

@SeRG1k17
Copy link

SeRG1k17 commented May 17, 2024

//sourcery:AutoMockable
protocol TestProtocol {
    associatedtype Value

    func getValue() -> Value
}

Generated.swift:

class TestProtocolMock: TestProtocol {
    //MARK: - getValue

    var getValueIntCallsCount = 0
    var getValueIntCalled: Bool {
        return getValueIntCallsCount > 0
    }
    var getValueIntReturnValue: Value!
    var getValueIntClosure: (() -> Value)?

    func getValue() -> Value {
        getValueIntCallsCount += 1
        if let getValueIntClosure = getValueIntClosure {
            return getValueIntClosure()
        } else {
            return getValueIntReturnValue
        }
    }
}

Also this doesn't work for primary associatedType
Environment:

  • Sourcery - 2.2.4
  • templete - AutoMockable.stencil (default)
  • command: Pods/Sourcery/bin/sourcery --sources ./SourceryMocks/Test.swift --templates Pods/Sourcery/Templates/AutoMockable.stencil --output ./SourceryMocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant