thing-testkit: the refused f11 payload blesses through its own writer; document_count

This commit is contained in:
Meta Vens 2026-11-27 21:42:56 +01:00
commit f0ed1d06aa
2 changed files with 10 additions and 10 deletions

View file

@ -51,13 +51,9 @@ impl FixtureSet {
}
/// Every document in the set, counted.
pub fn len(&self) -> usize {
pub fn document_count(&self) -> usize {
self.surfaces.len() + self.compositions.len() + self.catalogs.len() + self.invocations.len() + self.results.len()
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}
impl Fixture {
@ -129,8 +125,13 @@ impl Fixture {
rmp_serde::to_vec(&deep_surface(deepest_accepted() + 1)).unwrap()
}
/// Bless or compare the committed file of the refused payload; returns the committed bytes.
pub fn write_deep_refused() -> Vec<u8> {
golden::check(&Self::dir(), Self::DEEP_REFUSED, &Self::deep_refused_payload())
}
/// Encode the built documents into a store and bless or compare the committed file; returns
/// the committed bytes. f11 also blesses or compares its refused payload.
/// the committed bytes.
pub fn write(self) -> Vec<u8> {
let work = scratch_dir("write");
let scratch = work.join(self.file_name());
@ -154,9 +155,6 @@ impl Fixture {
drop(cache);
let bytes = std::fs::read(&scratch).unwrap();
let _ = std::fs::remove_dir_all(&work);
if self == Fixture::F11Deep {
golden::check(&Self::dir(), Self::DEEP_REFUSED, &Self::deep_refused_payload());
}
golden::check(&Self::dir(), self.file_name(), &bytes)
}

View file

@ -57,11 +57,13 @@ fn every_fixture_round_trips_through_the_contract() {
}
assert_eq!(
stored.len(),
loaded.len(),
loaded.document_count(),
"{}: the store holds the documents and nothing else",
fixture.file_name()
);
}
// The payload one Box level past f11's chain is a raw file, not a store.
assert_eq!(Fixture::write_deep_refused(), Fixture::deep_refused_payload());
});
}