From f0ed1d06aa8e84c532fd8f8eac634bf61b649870 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 21:42:56 +0100 Subject: [PATCH] thing-testkit: the refused f11 payload blesses through its own writer; document_count --- crates/thing-testkit/src/fixture.rs | 16 +++++++--------- crates/thing-testkit/tests/fixtures.rs | 4 +++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/thing-testkit/src/fixture.rs b/crates/thing-testkit/src/fixture.rs index 0df50fe..1f89564 100644 --- a/crates/thing-testkit/src/fixture.rs +++ b/crates/thing-testkit/src/fixture.rs @@ -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 { + 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 { 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) } diff --git a/crates/thing-testkit/tests/fixtures.rs b/crates/thing-testkit/tests/fixtures.rs index 131355a..de9e518 100644 --- a/crates/thing-testkit/tests/fixtures.rs +++ b/crates/thing-testkit/tests/fixtures.rs @@ -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()); }); }