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

refactor tests to use t.Fatal instead of panic #476

Closed
wants to merge 1 commit into from

Conversation

alexandear
Copy link
Contributor

t.Fatal is specifically designed for use in tests instead of panic. It stops tests execution immediately.

@rhysd
Copy link
Owner

rhysd commented Nov 12, 2024

Thanks for sending a patch.

However these panics are intentional.

  • panic is used when it should never fail due to the error. It's some kind of unreachable!() in Rust.
  • t.Fatal is used when it should make the test fail.

I distinguish between aborting the test and failing the test.

@rhysd rhysd closed this Nov 12, 2024
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