Skip to content

Inheritance across modules #344

@wvteijlingen-npo

Description

@wvteijlingen-npo

It seems impossible to generate a mock for a protocol that inherits a protocol from a SPM dependency. Is this a known limitation of mockolo? If so, would it be possible to extend mockolo in such a way that this is possible?

Input

// Module A from dependency
// We have no control over this source file

protocol Foo {
    var title: String { get }
}
// Module B

import ModuleA

/// @mockable
protocol Bar: Foo {}

Output

// Expected result
class BarMock: Bar {
    init() { }
    init(title: String = "") {
        self.title = title
    }
    var title: String = ""
}

// Actual result
class BarMock: Bar {

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions