diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 7e7352f..eb61157 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -43,7 +43,6 @@ jobs: - uses: taiki-e/install-action@cargo-llvm-cov - uses: taiki-e/install-action@nextest - # Note: We manually link zlib. This should be synchronized with the flags set for Linux in .cargo/config.toml. - name: Generate coverage report run: | cargo llvm-cov --no-fail-fast --lcov --output-path lcov.info nextest diff --git a/src/asset.rs b/src/asset.rs index 391fdd4..5f5379c 100644 --- a/src/asset.rs +++ b/src/asset.rs @@ -3,8 +3,9 @@ //! On desktop, assets are embedded using include_bytes!; on Emscripten, assets are loaded from the filesystem. use std::borrow::Cow; +use strum_macros::EnumIter; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EnumIter)] pub enum Asset { Wav1, Wav2, diff --git a/tests/asset.rs b/tests/asset.rs new file mode 100644 index 0000000..f21a09b --- /dev/null +++ b/tests/asset.rs @@ -0,0 +1,14 @@ +use pacman::asset::Asset; +use std::path::Path; +use strum::IntoEnumIterator; + +#[test] +fn test_asset_paths_valid() { + let base_path = Path::new("assets/game/"); + + for asset in Asset::iter() { + let path = base_path.join(asset.path()); + assert!(path.exists(), "Asset path does not exist: {:?}", path); + assert!(path.is_file(), "Asset path is not a file: {:?}", path); + } +}