MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / insert_empty_str

Function insert_empty_str

crates/table/src/page.rs:2201–2218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2199
2200 #[test]
2201 fn insert_empty_str() {
2202 let mut page = Page::new(STR_ROW_SIZE);
2203
2204 // First the hash is not saved, so compute it.
2205 let hash_pre_ins = hash_unmodified_save_get(&mut page);
2206
2207 // Insert the empty string.
2208 let offset = insert_str(&mut page, &[]);
2209
2210 // No granules were used.
2211 let extracted = read_str_ref(&page, offset);
2212 let mut granules_iter = unsafe { page.iter_var_len_object(extracted.first_granule) };
2213 assert!(granules_iter.next().is_none());
2214 drop(granules_iter);
2215
2216 // Hash is cleared even though the string was empty.
2217 assert_ne!(hash_pre_ins, hash_unmodified_save_get(&mut page));
2218 }
2219
2220 proptest! {
2221 #[test]

Callers

nothing calls this directly

Calls 5

hash_unmodified_save_getFunction · 0.85
insert_strFunction · 0.85
read_str_refFunction · 0.85
iter_var_len_objectMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…