Skip to content

MainActor tests#176

Merged
bradfol merged 6 commits intomainfrom
bradfol/main-actor-tests
Apr 28, 2025
Merged

MainActor tests#176
bradfol merged 6 commits intomainfrom
bradfol/main-actor-tests

Conversation

@bradfol
Copy link
Copy Markdown
Contributor

@bradfol bradfol commented Jul 16, 2024

Provide code use examples of async initializers and test coverage.

@bradfol bradfol force-pushed the bradfol/main-actor-tests branch 2 times, most recently from 02bf4c8 to 3508b25 Compare July 20, 2024 00:21
@bradfol bradfol force-pushed the bradfol/main-actor-tests branch from 3508b25 to 3cfa06d Compare April 25, 2025 17:26
@bradfol bradfol force-pushed the bradfol/main-actor-tests branch from 3cfa06d to b3cc5ca Compare April 25, 2025 17:27
@bradfol bradfol requested a review from skorulis-ap April 25, 2025 17:27
Comment thread Tests/KnitTests/MainActorTests.swift Outdated
Comment on lines +172 to +176
Task {
let result = await finalConsumer.askCustomGlobalActorClassToSayHello()
XCTAssertEqual(result, "Hello")
asyncExpectation.fulfill()
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be better for the test to be async and await the result without having to create a Task?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

)

container.register(
Future<CustomGlobalActorClass, Never>.self,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You might want to add Future to the list of special naming cases

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@bradfol bradfol enabled auto-merge April 28, 2025 19:04
@bradfol bradfol merged commit 722a910 into main Apr 28, 2025
2 checks passed
@bradfol bradfol deleted the bradfol/main-actor-tests branch April 28, 2025 19:58
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.

2 participants