Files
Sylpheed/crates/sylpheed-formats/tests/phase_objectives_disc.rs
MechaCat02 ccd49ac31f fix(lint): clear the clippy gate across examples and tests
80 findings, not the 14 the first run showed -- clippy stops at the first
failing compilation unit, so `--keep-going` is what makes the list complete.

60 were machine-applicable (`cargo clippy --fix`). The rest by hand:

* five descending `sort_by` -> `sort_by_key(Reverse(..))`
* `chunks_exact(4)` on both sides of four zips, so the compared items stay
  `[u8; 4]` rather than one array against one slice
* three `type` aliases for the census maps and the captured-quad tuple
* `&PathBuf` -> `&Path` in two disc tests
* two range loops; one of them keeps `#[allow(needless_range_loop)]` with the
  reason -- the index is into a map's value, which changes each iteration
* the module doc list in `invert_capture` re-indented to markdown's rules
* `blit`'s eight arguments get `#[allow(too_many_arguments)]`, not a struct

One dead `let off = b.len();` in a `ratc` test is dropped rather than renamed.
The sibling test at :162 is the one that asserts an offset; if this one was
meant to as well, that is a test change and not a lint fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-12 16:42:41 +02:00

47 lines
1.7 KiB
Rust

//! Per-phase MAIN objectives, straight from the localisation index.
//!
//! The mission-phase work went looking for what a phase asks the player to do
//! and reconstructed it from `SUBObjective_local_string.tbl` — the *bonus*
//! objectives — plus the guide script. `TextIndex` already indexes the main
//! ones under `S<NN>_P<n>_Objective_<i>`, so this pins them as a disc test and
//! makes the per-phase goals a checkable artifact rather than an inference.
use sylpheed_formats::{localization::TextIndex, PakArchive};
fn pak() -> Option<PakArchive> {
let disc = std::env::var("SYLPHEED_DISC").ok()?;
PakArchive::open(format!("{disc}/dat/GP_MAIN_GAME_E.pak")).ok()
}
#[test]
fn stage02_has_a_main_objective_for_each_phase() {
let Some(pak) = pak() else {
eprintln!("SYLPHEED_DISC unset - skipping");
return;
};
let text = TextIndex::build(&pak);
assert!(!text.is_empty(), "text index is empty");
for stage in ["S01", "S02"] {
for phase in 1..=3u32 {
let objs = text.objectives(stage, phase);
eprintln!("{stage} phase {phase}: {} objective line(s)", objs.len());
for o in &objs {
eprintln!(" {o}");
}
for h in text.hints(stage, phase) {
eprintln!(" hint: {h}");
}
for l in text.lose_conditions(stage, phase) {
eprintln!(" lose: {l}");
}
}
}
// Phase 1 of Stage 02 is the case the wave work could not observe; if the
// game states its goal at all, it is here.
assert!(
!text.objectives("S02", 1).is_empty(),
"no main objective text for Stage 02 phase 1"
);
}