diff options
| author | tv <tv@krebsco.de> | 2026-11-17 03:32:39 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-17 04:40:19 +0100 |
| commit | 345977eb749ebaa73632830cea42f19ce01e0ef1 (patch) | |
| tree | 294354a0cf04f030ebc6fe0e38329195fc07dd89 /src/document/events.rs | |
| parent | 948ee2a80abc2b242ff1a7187522a29e52927a8d (diff) | |
events: the tests put events at time 0
The same events put by the same writer make the same change, so that a
document built of them in a test is the same bytes on every run.
Diffstat (limited to 'src/document/events.rs')
| -rw-r--r-- | src/document/events.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/document/events.rs b/src/document/events.rs index 37f1c70..5cc9943 100644 --- a/src/document/events.rs +++ b/src/document/events.rs @@ -249,20 +249,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. +/// `events`, each at its ID, put into `doc` by one change, at time 0: the same events put +/// by the same writer make the same change. #[cfg(test)] pub(crate) fn put(doc: &mut Document, events: &[&[u8]]) { - super::testing::change(doc, |doc| { + super::testing::try_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"); + )?; } - }); + Ok::<(), store::StoreError>(()) + }) + .expect("events written"); } #[cfg(test)] |
