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

Testing IO () functions capturing their stdout/stderr etc. #439

Open
LeventErkok opened this issue Jan 26, 2025 · 2 comments
Open

Testing IO () functions capturing their stdout/stderr etc. #439

LeventErkok opened this issue Jan 26, 2025 · 2 comments

Comments

@LeventErkok
Copy link

This is essentially the same issue as reported in: #434

Since silently isn't thread-safe, end-users have few options here. Doctest (or doc-spec) can run output producing functions and test-them inline, so surely that technology can be ported to tasty?

In any case, would it be meaningful to add a facility to test IO () functions where their stdout acts as the test-output?

@Bodigrim
Copy link
Collaborator

Sounds useful, although I'm not sure it is easy / possible to implement in Tasty. The problem is that stdout is global, process-wide. One would have to force single-threaded test execution + add locks around progress / result reporting.

@LeventErkok
Copy link
Author

I wonder how doctest/docspec handle this problem: https://github.com/phadej/cabal-extras/tree/master/cabal-docspec

It surely can run doctests in parallel, and these functions can in general do IO (). Perhaps the trick they use can be somehow ported?

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