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

Add expect {} with coroutine support (suspend lambda) #1180

Closed
tenor-dev opened this issue Aug 25, 2022 · 1 comment
Closed

Add expect {} with coroutine support (suspend lambda) #1180

tenor-dev opened this issue Aug 25, 2022 · 1 comment

Comments

@tenor-dev
Copy link

Platform (all, jvm, js): all
Extension (none, kotlin 1.3): none

Currently you need to write

expect { runBlocking { suspendFunction() }}.toThrow<Something>()

It would be great to have suspending built-in:

coExpect { suspendFunction() }.toThrow<Something>()

"co" prefix is already used by mockk: coVerify() and coEvery(), so it will be familiar to developers.

coExpect function should be a suspend function itself, so it can be used inside of runTest {} from kotlinx-coroutines-test.

@robstoll
Copy link
Owner

Thanks for the idea, I'll consider your suggestion in #363.
Since this issue is a duplicate of it, I'll close this one. Please up-vote the other (react with 👍 on the issue description).
See #363 (comment) for a function you could use until atrium provides something built in.
In case you have some spare time, then please read the discussion in the other issue and add your comment, thanks

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

No branches or pull requests

2 participants