pub struct Fixture { /* private fields */ }Expand description
One project, on disk, detected the way the host detects it.
The files are written into a temporary directory that lives as long as the fixture. The detection is the real one: the same scoring, the same family and plugin choice, on the markers a manifest declares – so a fixture test fails when the plugin’s own markers stop matching, which is exactly the kind of breakage a hand-built context cannot catch.
Implementations§
Source§impl Fixture
impl Fixture
Sourcepub fn file(self, name: &str, contents: &str) -> Self
pub fn file(self, name: &str, contents: &str) -> Self
Write one file, creating its directory if it has one.
Sourcepub fn plugin(
self,
name: &str,
family: &str,
strong: &[&str],
weak: &[&str],
) -> Self
pub fn plugin( self, name: &str, family: &str, strong: &[&str], weak: &[&str], ) -> Self
Declare a plugin, with the markers its manifest would carry.
Sourcepub fn pin(self, family: &str, plugin: &str) -> Self
pub fn pin(self, family: &str, plugin: &str) -> Self
Pin a family to a plugin, as a .pmpx.toml would.
Sourcepub fn prefer(self, families: &[&str]) -> Self
pub fn prefer(self, families: &[&str]) -> Self
Order families, for the cases where two of them tie.
Sourcepub fn declares<I, S>(self, names: I) -> Self
pub fn declares<I, S>(self, names: I) -> Self
The files the plugin’s manifest says it wants to see.
Only these are read into the context – the declaration is the allowlist, so a test that asks for something undeclared gets a context without it, exactly as the host would.
Sourcepub fn context(&self) -> Context<'static>
pub fn context(&self) -> Context<'static>
Run the detection and build the context the host would hand over.
The verb and the arguments are not part of a Context: they are what the plugin is called
with, so a test passes them to
command itself.
§Panics
When the detection picks nothing – which in a fixture test almost always means the markers a plugin declares do not match the files the test wrote, so the panic says which files are there.