uber / mockolo

Efficient Mock Generator for Swift
Apache License 2.0
805 stars 85 forks source link

support for async properties? #210

Open alessioborraccino opened 1 year ago

alessioborraccino commented 1 year ago

After swift 5.6 it's possible to declare in protocols async and/or throws properties:

/// @mockable
protocol AsyncProperties {
  var isAvailable: Bool { get async throws }
}

but mockolo still doesnt support this syntax, and generates just a simple Bool property.

class AsyncPropertiesMock: AsyncProperties {
    init() { }
    init(isAvailable: Bool = false) {
        self.isAvailable = isAvailable
    }

    var isAvailableSetCallCount = 0
    var isAvailable: Bool = false { didSet { isAvailableSetCallCount += 1 } }
}

is there any plan to update it so that /// @mockable can successfully also generate an async throws handler for this case?

sidepelican commented 1 year ago

It should be fixed, but I think it is a less common requirement, so it is not a priority.

alessioborraccino commented 9 months ago

Not fixed, without a handler i cant test any throwing because the mock doesnt actually throws. Hoping in an update eventually :)