mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-09 08:08:13 -06:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43ce8a4e01 | |||
| 1529a64588 | |||
| be5eec64c9 |
4
.github/workflows/coverage.yaml
vendored
4
.github/workflows/coverage.yaml
vendored
@@ -42,11 +42,11 @@ jobs:
|
||||
|
||||
- uses: taiki-e/install-action@cargo-llvm-cov
|
||||
- uses: taiki-e/install-action@nextest
|
||||
- uses: taiki-e/install-action@just
|
||||
|
||||
# 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
|
||||
just coverage
|
||||
|
||||
- name: Upload coverage to Coveralls
|
||||
uses: coverallsapp/github-action@v2
|
||||
|
||||
18
Justfile
Normal file
18
Justfile
Normal file
@@ -0,0 +1,18 @@
|
||||
set shell := ["bash", "-c"]
|
||||
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
|
||||
|
||||
coverage_exclude_pattern := "app.rs|audio.rs"
|
||||
|
||||
# Display report (for humans)
|
||||
report-coverage: coverage
|
||||
cargo llvm-cov report \
|
||||
--ignore-filename-regex "{{ coverage_exclude_pattern }}"
|
||||
|
||||
# Run & generate report (for CI)
|
||||
coverage:
|
||||
cargo llvm-cov \
|
||||
--lcov \
|
||||
--ignore-filename-regex "{{ coverage_exclude_pattern }}" \
|
||||
--output-path lcov.info \
|
||||
--profile coverage \
|
||||
--no-fail-fast nextest
|
||||
10
bacon.toml
10
bacon.toml
@@ -36,7 +36,7 @@ analyzer = "nextest"
|
||||
|
||||
[jobs.coverage]
|
||||
command = [
|
||||
"cargo", "llvm-cov", "--profile", "coverage", "--color", "always", "--no-fail-fast", "nextest", "--no-capture", "--summary-only", "--"
|
||||
"just", "report-coverage"
|
||||
]
|
||||
need_stdout = true
|
||||
ignored_lines = [
|
||||
@@ -49,8 +49,14 @@ ignored_lines = [
|
||||
"[─]+",
|
||||
"test.+ok",
|
||||
"PASS|START",
|
||||
"Starting \\d+ test"
|
||||
"Starting \\d+ test",
|
||||
"\\s*#",
|
||||
"\\s*Finished.+in \\d+",
|
||||
"\\s*Summary\\s+\\[",
|
||||
"\\s*Blocking",
|
||||
"Finished report saved to"
|
||||
]
|
||||
on_change_strategy = "wait_then_restart"
|
||||
|
||||
[jobs.doc]
|
||||
command = ["cargo", "doc", "--no-deps"]
|
||||
|
||||
@@ -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,
|
||||
|
||||
14
tests/asset.rs
Normal file
14
tests/asset.rs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user