caelum0x 8af85c6e28 style: format workspace to rustfmt.toml (use_small_heuristics = Max)
Bring the whole workspace into compliance with the repo's rustfmt config
(edition 2024, max_width 100, use_small_heuristics = "Max"), which had drifted
across many crates. Pure formatting — no logic changes; `cargo fmt --check` is
now clean and `cargo build --workspace` is green.
2026-08-18 16:59:40 +03:00

20 lines
870 B
Rust

use lawsynth_store::{MemoryStore, ObjectKey, ObjectStore, StoreConfig, StoreError};
#[test]
fn validates_keys_limits_and_sorted_prefix_listing() {
assert!(ObjectKey::new("../escape").is_err());
let store =
MemoryStore::new(StoreConfig { max_object_bytes: 3, cache_capacity_bytes: 8 }).unwrap();
let key = ObjectKey::new("runs/a.bin").unwrap();
assert!(matches!(
store.put(key.clone(), vec![1, 2, 3, 4]),
Err(StoreError::ObjectTooLarge { .. })
));
let stored = store.put(key.clone(), vec![1, 2, 3]).unwrap();
assert!(stored.verify());
assert_eq!(store.get(&key).unwrap().bytes, vec![1, 2, 3]);
store.put(ObjectKey::new("runs/b.bin").unwrap(), vec![]).unwrap();
assert_eq!(store.list(Some("runs/")).unwrap().len(), 2);
assert!(store.delete(&key).unwrap());
assert!(!store.contains(&key).unwrap());
}