summaryrefslogtreecommitdiffstats
path: root/libimagstore
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-09-21 10:08:01 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-10-07 17:32:35 +0200
commit1e83ad7bbd8834d555bb0e7387e824a2ea1fe503 (patch)
treea5990812481f0343413807215740367726ddd095 /libimagstore
parentd9f4898a3afb4bb515d7d420421e31e02779034f (diff)
Add test for hook execution for each hook position
Diffstat (limited to 'libimagstore')
-rw-r--r--libimagstore/src/store.rs57
1 files changed, 56 insertions, 1 deletions
diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs
index 4a9a4524..cbe7b54d 100644
--- a/libimagstore/src/store.rs
+++ b/libimagstore/src/store.rs
@@ -2654,9 +2654,64 @@ aspect = "test"
}
#[test]
- fn test_pre_create() {
+ fn test_storeunload() {
+ test_hook_execution(&[HP::StoreUnload]);
+ }
+
+ #[test]
+ fn test_precreate() {
test_hook_execution(&[HP::PreCreate]);
}
+ #[test]
+ fn test_postcreate() {
+ test_hook_execution(&[HP::PostCreate]);
+ }
+
+ #[test]
+ fn test_preretrieve() {
+ test_hook_execution(&[HP::PreRetrieve]);
+ }
+
+ #[test]
+ fn test_postretrieve() {
+ test_hook_execution(&[HP::PostRetrieve]);
+ }
+
+ #[test]
+ fn test_preupdate() {
+ test_hook_execution(&[HP::PreUpdate]);
+ }
+
+ #[test]
+ fn test_postupdate() {
+ test_hook_execution(&[HP::PostUpdate]);
+ }
+
+ #[test]
+ fn test_predelete() {
+ test_hook_execution(&[HP::PreDelete]);
+ }
+
+ #[test]
+ fn test_postdelete() {
+ test_hook_execution(&[HP::PostDelete]);
+ }
+
+ #[test]
+ fn test_multiple_same_position() {
+ let positions = [ HP::StoreUnload, HP::PreCreate, HP::PostCreate, HP::PreRetrieve,
+ HP::PostRetrieve, HP::PreUpdate, HP::PostUpdate, HP::PreDelete, HP::PostDelete ];
+
+ for position in positions.iter() {
+ for n in 2..10 {
+ let mut v = Vec::with_capacity(n);
+ for x in 0..n { v.push(position.clone()); }
+
+ test_hook_execution(&v);
+ }
+ }
+ }
+
}