diff options
| author | tv <tv@krebsco.de> | 2026-11-16 22:47:30 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-17 00:08:49 +0100 |
| commit | 65e9d86e48e3fd182882ceb54b9b8b1ff475369d (patch) | |
| tree | 2945d28d1ecde1f281896ce13dbc8b6c8b776b99 /src/document | |
| parent | bae1b3ce82ee67e059bfbe75a69cbe970a6213f9 (diff) | |
store: a test per attack row marked unit
Each row of `docs/store.md`, Attacks, marked unit has its test,
`store_attack_<row>`: where it is judged (`access::holding`, `access::token`), where
the store held in memory meets it (`federation::store::memory`), and where a node reads
its store from its document (`federation::held`). Tests that checked a row already take
its name; a check reads the doc's rows and fails on a unit row without its test, but for
rows 21 and 22, which the remakes bring.
Diffstat (limited to 'src/document')
| -rw-r--r-- | src/document/events.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/document/events.rs b/src/document/events.rs index 5fce55d..ab8675b 100644 --- a/src/document/events.rs +++ b/src/document/events.rs @@ -132,6 +132,22 @@ pub(crate) fn is_genesis(change: &Change, fold: &str, id: &Id) -> bool { root.is_some_and(|root| genesis(fold, &root).hash() == change.hash()) } +/// `events`, each at its ID, put into `doc` by one change. +#[cfg(test)] +pub(crate) fn put(doc: &mut Document, events: &[&[u8]]) { + super::testing::change(doc, |doc| { + for bytes in events { + store::write_val_path( + doc, + &event(&Id::of(bytes)), + &Val::Scalar(ScalarValue::Bytes(bytes.to_vec())), + store::Writing::sticky(TimestampFormat::default()), + ) + .expect("an event written"); + } + }); +} + #[cfg(test)] mod tests { use super::*; |
