Skip to content

2.6.0

Choose a tag to compare

@sidepelican sidepelican released this 24 Mar 02:53
· 13 commits to master since this release
9c0c92f

New features

  • Support elseif/else directive by @fummicc1 in #328

    #if DEBUG
    import Foundation
    #elseif FEATURE_X
    import FeatureX
    #else
    import Production
    #endif
    
    /// @mockable
    protocol PresentableListener: AnyObject {
        func run()
        #if DEBUG
        func showDebugMode()
        #elseif FEATURE_X
        func showFeatureXMode()
        #else
        func showReleaseMode()
        #endif
    } 
  • Unify handler injection way between class-based and actor-based mocks. by @fummicc1 in #334

    /// @mockable
    protocol Foo: Actor {
        func baz(arg: String) async -> Int
    }
    
    actor FooMock: Foo {
        ...
        // `nonisolated` is added!
        nonisolated var bazHandler: ((String) async -> Int)? {
            get { bazState.withLock(\.handler) }
            set { bazState.withLock { $0.handler = newValue } }
        }
    
  • Add subscript setter support with handler and call count by @farkasseb in #337

    /// @mockable
    public protocol SendableSubscriptProtocol: Sendable {
        subscript(key: Int) -> String { get set }
    }
    
    public final class SendableSubscriptProtocolMock: SendableSubscriptProtocol, @unchecked Sendable {
        ...
        public var subscriptHandler: (@Sendable (Int) -> String)? {
            get { subscriptState.withLock(\.handler) }
            set { subscriptState.withLock { $0.handler = newValue } }
        }
        
        ...
        // `SetHandler` is new!
        public var subscriptSetHandler: (@Sendable (Int, String) -> ())? {
            get { subscriptSetState.withLock(\.handler) }
            set { subscriptSetState.withLock { $0.handler = newValue } }
        }
    

Fix bugs

  • Fix incorrect handling of MetatypeType (T.Type) by @sidepelican in #333
  • Fix Name Override With Inheritance by @plx in #338

Maintenances

New Contributors

Full Changelog: 2.5.0...2.6.0

For Build Tools Plugin (artifactbundle)

.binaryTarget(
    name: "mockolo",
    url: "https://github.com/uber/mockolo/releases/download/2.6.0/mockolo.artifactbundle.zip",
    checksum: "47bf9befcb1a92ba801d13018c8e1f110e3bb9fd6b19e4983d53a3a0ad986780"
),