Skip to content

Generated mocks do not handle generic functions #8

@abbeyjackson

Description

@abbeyjackson

Protocols which contain generic functions can not be generated because the generic type can not be determined.

ex, this function:

`func getObjects<T: RealmSwift.Object>(_ objects: T.Type) -> Results<T>?`

Will generate as:

    var invokedGetObjects = false
    var invokedGetObjectsCount = 0
    var invokedGetObjectsParameters: (objects: T.Type, Void)?
    var invokedGetObjectsParametersList = [(objects: T.Type, Void)]()
    var stubbedGetObjectsResult: Results<T>!
    func getObjects<T: RealmSwift.Object>(_ objects: T.Type) -> Results<T>? {
        invokedGetObjects = true
        invokedGetObjectsCount += 1
        invokedGetObjectsParameters = (objects, ())
        invokedGetObjectsParametersList.append((objects, ()))
        return stubbedGetObjectsResult
    }

Where type 'T' is undeclared.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions