Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
swift-dependencies-source-control-client Sources SourceControlClientTestSupport SourceControlClientTestSupport.swift
874 B · 33 lines
Swift
12345678910111213141516171819202122232425262728293031323334#if canImport(Testing)import Dependenciesimport DependenciesTestSupportimport SourceControlClientimport Testing
public struct SourceControlClientBackend: Sendable { public var makeClient: @Sendable () -> SourceControlClient
public init(_ makeClient: @escaping @Sendable () -> SourceControlClient) { self.makeClient = makeClient }
public static var unimplemented: Self { Self { .unimplemented } }
public static func client( _ client: @autoclosure @escaping @Sendable () -> SourceControlClient ) -> Self { Self { client() } }}
public extension Trait where Self == _DependenciesTrait { static func sourceControlClient(_ backend: SourceControlClientBackend) -> Self { .dependencies { $0.context = .test $0.sourceControl = backend.makeClient() } }}#endif