From c9994c33b679528078bc43cfa790b4dbecec59a3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 5 Sep 2016 15:20:55 +0200 Subject: [PATCH] Add test whether store-internal hashmap gets actually filled on Store::create() --- libimagstore/src/store.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index e061e855..9465fc73 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -2239,5 +2239,22 @@ mod store_tests { } } + #[test] + fn test_store_create_in_hm() { + use storeid::StoreId; + + let store = get_store(); + + for n in 1..100 { + let pb = StoreId::new_baseless(PathBuf::from(format!("test-{}", n))).unwrap(); + + assert!(store.entries.read().unwrap().get(&pb).is_none()); + assert!(store.create(pb.clone()).is_ok()); + + let pb = pb.with_base(store.path().clone()); + assert!(store.entries.read().unwrap().get(&pb).is_some()); + } + } + }