-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
159 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,20 @@ | ||
import Mocked | ||
|
||
protocol ThisBreaksShit { | ||
var broken: String { get } | ||
} | ||
|
||
@Mocked | ||
protocol SomeParameter: Sendable { | ||
var title: String { get set } | ||
var description: String { get } | ||
protocol ExampleProtocol: Sendable { | ||
associatedtype ItemType: Codable | ||
associatedtype ItemValue: Equatable | ||
|
||
func someMethod() | ||
func someMethod(parameter: Int) | ||
func someMethod(with parameter: Int) | ||
var name: String { get set } | ||
var count: Int { get } | ||
var isEnabled: Bool { get set } | ||
|
||
func someOtherMethod() throws -> String | ||
func someOtherMethod() async throws -> String | ||
func fetchItem(withID id: Int) async throws -> ItemType | ||
func saveItem(_ item: ItemType) throws -> Bool | ||
|
||
func someAsyncMethod() async -> String | ||
|
||
func someOptionalMethod() -> String? | ||
func processAllItems() async | ||
func reset() | ||
func optionalItem() -> ItemType? | ||
} | ||
|
||
Task { @MainActor in | ||
let mockedParameter = MockedSomeParameter( | ||
title: "Hello", | ||
description: "Descrip", | ||
someMethodParameter: { print("\($0)") }, | ||
someOtherMethodAsyncThrows: { "?" } | ||
) | ||
|
||
mockedParameter.someMethod(parameter: 3) | ||
let value = try await mockedParameter.someOtherMethod() | ||
|
||
print(value) | ||
|
||
} | ||
let mock = MockedExampleProtocol<String, String>(name: "Leif", count: 0, isEnabled: true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters