Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support actor object conforming to Actor protocol #222

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

treastrain
Copy link

Issue

Part of #216
(#216 (comment) 's "2.")

Description

Add feature generating mocks for that protocol that conform to the Actor automatically become actor.

For details: #216 (comment)

@CLAassistant
Copy link

CLAassistant commented Mar 9, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@uhooi uhooi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx PR!!


let actorProtocol =
"""
/// \(String.mockAnnotation)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also like you to write the following test.

/// \(String.mockAnnotation)
protocol Foo: Bar {
    func foo(arg: String) async -> Result<String, Error>
    var bar: Int { get }
}

protocol Bar: Actor {
    func baz(arg: String) async -> Result<String, Error>
    var qux: Int { get }
}

@uhooi
Copy link
Collaborator

uhooi commented Mar 13, 2023

@treastrain
The test is failing in Xcode 12.
Since Swift Concurrency (async/await, Actor etc) is available from Xcode 13, please skip the test in Xcode 12.

Test Suite 'MockActorTests' started at 2023-03-10 13:00:08.892
Test Case '-[MockoloTests.MockActorTests testActorProtocol]' started.
/Users/runner/work/mockolo/mockolo/Tests/MockoloTestCase.swift:154: error: -[MockoloTests.MockActorTests testActorProtocol] : XCTAssertTrue failed
Test Case '-[MockoloTests.MockActorTests testActorProtocol]' failed (1.854 seconds).
Test Suite 'MockActorTests' failed at 2023-03-10 13:00:10.746.
	 Executed 1 test, with 1 failure (0 unexpected) in 1.854 (1.854) seconds

ref: https://github.com/uber/mockolo/actions/runs/4376819642/jobs/7676406579#step:5:251

Copy link
Collaborator

@sidepelican sidepelican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can say the same things with #221 . See it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants