bevy/tools
Gino Valente f8ef767ab0
compile_fail_utils: Verify path exists (#14827)
# 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"
```
2024-08-22 16:54:26 +00:00
..
build-templated-pages Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
build-wasm-example Fix common capitalization errors in documentation (#14562) 2024-07-31 21:16:05 +00:00
ci Fix CI bench compile check (#14728) 2024-08-14 13:23:00 +00:00
compile_fail_utils compile_fail_utils: Verify path exists (#14827) 2024-08-22 16:54:26 +00:00
example-showcase Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
publish.sh Remove deprecated bevy_dynamic_plugin (#14534) 2024-07-30 15:31:08 +00:00