mirror of
https://github.com/bevyengine/bevy
synced 2024-12-19 01:23:09 +00:00
f8ef767ab0
# Objective It looks like running `compile_fail_utils::test` on an invalid path just skips the test. I'm not sure why `ui_test` doesn't fail the test, but it seems pretty easy to accidentally cause a test to be skipped (I experienced [this](https://github.com/bevyengine/bevy/pull/14813#discussion_r1721880973) while doing some refactoring on `bevy_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 `cd` into `crates/bevy_reflect/compile_fail`. Then run the following: ``` cargo test --target-dir ../../../target ``` All compile fail tests should pass. Now edit the path used in `crates/bevy_reflect/compile_fail/tests/derive.rs`. For example: ```diff 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: ``` cargo test --target-dir ../../../target ``` Verify the test fails with an error like: ``` Error: path does not exist: "tests/does_not_exist" ``` |
||
---|---|---|
.. | ||
lib.rs |