foch_test/lib.rs
1//! In-game tests for EU4 mods, modeled on pytest and Rust's test harness.
2//!
3//! The library computes; its caller does input and output. It never walks
4//! directories, reads configuration, launches processes or prints. A run is
5//! a sequence of plain-data stages, each testable on its own:
6//!
7//! ```text
8//! SourceFile ─collect→ Collection ─expand→ Expanded ─lint→ LintResult
9//! └──────group──→ Plan
10//! Plan ─compile→ Bundle ─(caller runs the runner)→ RunArtifacts ─judge→ CaseResult
11//! CaseResult* ─→ Report
12//! ```
13//!
14//! [`judge`](judge::judge) is the single place that decides whether a case
15//! passed. Sharing a game session between cases is an optimization decided by
16//! [`group`](plan::group) from each case's declared needs and its estimated
17//! footprint; a case's verdict must not depend on it.
18
19pub mod collect;
20pub mod compile;
21pub mod diagnostic;
22pub mod judge;
23pub mod lint;
24pub mod model;
25pub mod plan;
26pub mod report;
27pub mod select;
28pub mod source;
29
30pub use collect::{Collection, collect};
31pub use compile::{Bundle, RunContext, RunnerCapabilities, check_capabilities, compile};
32pub use diagnostic::{Diagnostic, DiagnosticCode, Severity, blocks_run};
33pub use judge::{CaseResult, RunArtifacts, RunnerExit, Status, Timing, judge, reconcile};
34pub use lint::{Footprint, LintResult, ProjectFacts, lint};
35pub use plan::{ExpandOptions, Expanded, GroupOptions, Plan, expand, group};
36pub use report::Report;
37pub use select::Selector;
38pub use source::{RelPath, SourceFile, SourceKind};
39
40use foch::model::GamePath;
41
42/// A parser path label for internal parsing.
43pub(crate) fn game_path(text: &str) -> &GamePath {
44 GamePath::new(text).expect("valid game path label")
45}