compile_fail_utils: Verify path exists#14827
Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom Aug 22, 2024
Merged
Conversation
killercup
approved these changes
Aug 20, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
It looks like running
compile_fail_utils::teston an invalid path just skips the test. I'm not sure whyui_testdoesn't fail the test, but it seems pretty easy to accidentally cause a test to be skipped (I experienced this while doing some refactoring onbevy_reflect).Solution
Check to make sure the given path exists before continuing on with the tests.
Alternatively, we could look into seeing why this doesn't work properly upstream. But I figured this solution was simple enough just to implement directly without having to worry about updating
ui_test.Testing
To verify that this works as expected
cdintocrates/bevy_reflect/compile_fail. Then run the following:All compile fail tests should pass. Now edit the path used in
crates/bevy_reflect/compile_fail/tests/derive.rs. For example:fn main() -> compile_fail_utils::ui_test::Result<()> { - compile_fail_utils::test("reflect_derive", "tests/reflect_derive") + compile_fail_utils::test("reflect_derive", "tests/does_not_exist") }Run the tests again:
Verify the test fails with an error like: