Skip to content

Generated code does not follow the enclosing class access control #42

Open
@GustavoVergara

Description

@GustavoVergara

When code is generated it doesn’t set an access control to anything.
This raises a compiler error when both the protocol and the mock class are public/open.

For example, this protocol and class:

public protocol FooProtocol {
    func bar(arg: String) -> Int
}

public class FooSpy: FooProtocol {
    var invokedBar = false
    var invokedBarCount = 0
    var invokedBarParameters: (arg: String, Void)?
    var invokedBarParametersList = [(arg: String, Void)]()
    var stubbedBarResult: Int! = 0

    func bar(arg: String) -> Int {
        invokedBar = true
        invokedBarCount += 1
        invokedBarParameters = (arg, ())
        invokedBarParametersList.append((arg, ()))
        return stubbedBarResult
    }
}

Raises the error:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions