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

allow tests to fail #8629

Closed
andrewrk opened this issue Apr 27, 2021 · 4 comments · Fixed by #8686
Closed

allow tests to fail #8629

andrewrk opened this issue Apr 27, 2021 · 4 comments · Fixed by #8686
Labels
accepted This proposal is planned. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@andrewrk
Copy link
Member

I propose to modify the default test runner so that when a test returns an error, the test is marked as failure, however subsequent tests are still run. At the end will be reported the failures and successes, and the final exit code of zig test will be 0 if and only if all tests succeeded with no memory leaks.

Follow-up proposal: modify std.testing.expectEqual and similar functions to return error.ZigTestFailed rather than calling panic.

Motivation is to increase developer iteration speed; it might help to find out more than one thing is broken at a time.

@andrewrk andrewrk added standard library This issue involves writing Zig code for the standard library. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. labels Apr 27, 2021
@andrewrk andrewrk added this to the 0.9.0 milestone Apr 27, 2021
@marler8997
Copy link
Contributor

Maybe provide an option to quit on the first failure as well?

@kubkon kubkon added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. and removed contributor friendly This issue is limited in scope and/or knowledge of Zig internals. labels Apr 28, 2021
@kubkon
Copy link
Member

kubkon commented Apr 28, 2021

This will be a good first issue once it is accepted.

@daurnimator
Copy link
Collaborator

Follow-up proposal: modify std.testing.expectEqual and similar functions to return error.ZigTestFailed rather than calling panic.

This implies that all call-sites will now need to be updated to do try std.testing.expect*?

@ityonemo
Copy link
Sponsor Contributor

ityonemo commented May 4, 2021

Yes please. I think I had questions about how to recover from a panic that I won't need when hooking up zig tests into elixirs test suite.

@andrewrk andrewrk added accepted This proposal is planned. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. labels May 4, 2021
@andrewrk andrewrk modified the milestones: 0.9.0, 0.8.0 May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This proposal is planned. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants