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 TestCases::full_build() to force full builds. #294

Closed
wants to merge 1 commit into from

Conversation

de-vri-es
Copy link

Currently, trybuild uses cargo check for compile-fail tests, and only uses cargo-build if there are pass tests.

Some build failures are not detected by cargo check, but only by cargo build. This is arguably a problem of cargo check, but it is the current reality and as far as I can tell, unlikely to change soon.

People using trybuild are now adding an empty pass tests to work around this problem. While this works, it also clutters the output with [should pass] and [should fail to compile].

This PR is a very simple addition to the API that allows users to opt-in to using cargo build for all tests, without cluttering the output.

Since trybuild is all about verifying compile failures, being able to verify failed const-evaluated assertions seems like a pretty important use case. And, as noted before (#225 (comment)), the availability of const { } blocks lifted this use case out of the realm of unreliable hacks.

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

My preference in #258 is for this to be handled by a different library (maybe along with some other feature requests labeled out of scope Ideas to consider for someone building a more fully featured ui testing library ). This crate is only doing what I need.

@dtolnay dtolnay closed this Oct 23, 2024
@de-vri-es
Copy link
Author

Hmm, I don't want to nag, but could you reconsider?

At the moment this is the best library for validating compilation failures (I think). I would hate for such a simple change to require forking the crate, but I really need support for verifying const { assert!(...) }.

If the answer is still "no" I guess I will fork and try to think of another clever name :(

@golddranks
Copy link

Maybe fork with name willitbuild, as a reference to the "Will It Blend" commercials? As you can see from the linked issue that was deemed out of scope Ideas to consider for someone building a more fully featured ui testing library , I was also interested in this functionality.

@golddranks
Copy link

It should be noted, that since Rust 1.79, const blocks are stable, and assert!() in const has been stable for a while. It's becoming more and more common to have static assertions against type sizes, associated consts of generic types etc. This crate is not going to help catching tests of those compile errors, which means it's going to get more and more irrelevant over time without this support. I think @dtolnay should indeed reconsider.

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.

3 participants