Skip to content

Conversation

@DylanD42
Copy link

@DylanD42 DylanD42 commented Nov 6, 2025

Objective

Solution

  • Added a check into parse_internal that checks if asset_path is empty, if so throw a EmptyPath panic, standard to other parsing

Testing

  • Added a test that shows a example of asset loading with a correct and a incorrect path, as intended. Also added a test for empty string that will result in a panic.
  • Further testing on varying file types may be beneficial.

use bevy::asset::LoadState;

#[test]
fn test_asset_load_valid_file() {
Copy link
Contributor

Choose a reason for hiding this comment

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

bevy_asset/src/lib.rs already contains a bunch of tests, which you could use as examples. It might be better to just add a new test there rather than start something new here (especially since those tests already have a bunch of utilities for writing tests more conveniently).

@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Uncontroversial This work is generally agreed upon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad error message for loading empty string as an asset.

3 participants