Skip to main content

Module fixtures

Module fixtures 

Source
Expand description

#2841: the checker-side rules for a suite’s fixture name = "path" declarations — the path rules and the content rules shared with embed (crate::embeds, crate::assets) but for the project’s fixtures/ folder, the name rules, and the unused warning.

A fixture is a project file’s text, a String constant in the declaring suite’s cases. Unlike an embed it is test-only: its text goes into test output and never into a deployable, so it comes from fixtures/ (not embeds/), may be large (MAX_FIXTURE_BYTES), and has no project total.

The checker stays disk-free: the folder reaches it from the caller as a [bynk_project::assets::FixtureFolder], and read_declared_fixtures reads only the files a declaration names.

Constants§

MAX_FIXTURE_BYTES
The largest fixture file, in bytes. A fixture never ships, so the cap only keeps a test module a reasonable size; there is no project total.

Functions§

check_suite_fixtures
The name rules and the unused warning for one suite’s fixtures.
outside_fixtures_dir_error
bynk.fixture.outside_fixtures_dir for f, when its path is safe but does not lie inside the project’s fixtures folder, so a declaration can never read .env or a source file by mistake.
path_errors
The path rules for f, in order (at most one applies).
phase_fixture_files
The path errors (path_errors) for each fixture, and bynk.fixture.missing_file for each whose (otherwise valid) path names no file in available — the project’s fixtures/ folder as the caller read it. None skips the check (nothing on disk was consulted).
read_declared_fixtures
The text of every declared fixture file in folder, keyed by normalised path — read through the folder’s reader once each, and only for a file a declaration names. Content rules are an embed’s (crate::embeds::embedded_text): valid UTF-8 (bynk.fixture.invalid_encoding), no NUL byte (bynk.fixture.binary_content), a BOM dropped and newlines normalised; and at most MAX_FIXTURE_BYTES (bynk.fixture.too_large). A read failure is bynk.fixture.unreadable_file. Each is reported on every declaration that names the file, and the file is left out.
unsafe_path_error
bynk.fixture.unsafe_path for f, when its path is empty, absolute or contains a .. segment (the rule an asset’s and an embed’s paths follow).