Expand description
Catalogued-fixture resolution (tests/models/**).
Catalogued fixtures are not committed (tests/models/manifest.json), so a
test that needs one skips when it is absent. A skip is invisible in
cargo test output, which is issue #2802: a passing skip-shaped test looks
the same as one that asserted something. IFC_LITE_REQUIRE_FIXTURES=1
(set by CI after pnpm fixtures) turns every skip into a panic.
fixture_bytes and fixture_text are the one decision point:
| outcome | gate off | gate on (=1) |
|---|---|---|
| file present | Some | Some |
NotFound | None (skip) | panic |
| Git LFS pointer (not fetched) | None (skip) | panic |
| any other I/O error / bad UTF-8 | panic | panic |
The gate value is parsed strictly: only unset, "", "0" (off) and "1"
(on) are accepted; anything else (true, yes, a typo) panics, because
guessing “off” would recreate the silent-pass failure.
Enums§
- Fixture
Error - Why a fixture could not be returned (the pure decision, see
classify).
Functions§
- classify
- Classify a read result.
Ok(Ok(bytes))is a usable fixture,Ok(Err(_))a skippable absence, and a hard I/O error panics. - fixture_
bytes - Bytes of the catalogued fixture
rel(relative totests/models/), orNoneto skip. See the module table for the gate semantics. - fixture_
path - Absolute path of the catalogued fixture
rel(relative totests/models/). - fixture_
present - Whether the catalogued fixture
relis present, with the same gate semantics asfixture_bytes(absent or an LFS pointer:false, or a panic under the gate). Reads only the first bytes, so it is cheap for large models that the caller then loads itself. - fixture_
text fixture_bytesdecoded as UTF-8 (invalid UTF-8 panics: a corrupt fixture is a setup error, not an absence).- local_
fixture_ text - Text of a PRIVATE, un-manifested local model under
tests/models/(onepnpm fixturescan never supply). Absent or an LFS pointer is alwaysNone– the gate deliberately does not apply, or the suite would fail CI unconditionally – while any other I/O error or bad UTF-8 still panics. Catalogued fixtures must usefixture_textinstead. - repo_
root - The repository root, derived from this crate’s location (
rust/testkit). - require_
fixtures - Parse
IFC_LITE_REQUIRE_FIXTURES, failing closed on the config itself. - require_
fixtures_ from - The pure decision behind
require_fixtures; a parameter so tests need not mutate the process environment (tests run on shared threads). - resolve_
bytes - Decide the outcome for
relgiven an explicit gate value (testable core).