Rename: SucceedingHook -> TestHook

This commit is contained in:
Matthias Beyer 2016-09-22 08:46:59 +02:00
parent 7124a1d27e
commit 886eed3ff4

View file

@ -2372,36 +2372,36 @@ mod store_tests {
#[cfg(test)] #[cfg(test)]
mod store_hook_tests { mod store_hook_tests {
mod succeeding_hook { mod test_hook {
use hook::Hook; use hook::Hook;
use hook::accessor::HookDataAccessor; use hook::accessor::HookDataAccessor;
use hook::accessor::HookDataAccessorProvider; use hook::accessor::HookDataAccessorProvider;
use hook::position::HookPosition; use hook::position::HookPosition;
use self::accessor::SucceedingHookAccessor as DHA; use self::accessor::TestHookAccessor as DHA;
use toml::Value; use toml::Value;
#[derive(Debug)] #[derive(Debug)]
pub struct SucceedingHook { pub struct TestHook {
position: HookPosition, position: HookPosition,
accessor: DHA, accessor: DHA,
} }
impl SucceedingHook { impl TestHook {
pub fn new(pos: HookPosition) -> SucceedingHook { pub fn new(pos: HookPosition) -> TestHook {
SucceedingHook { position: pos.clone(), accessor: DHA::new(pos) } TestHook { position: pos.clone(), accessor: DHA::new(pos) }
} }
} }
impl Hook for SucceedingHook { impl Hook for TestHook {
fn name(&self) -> &'static str { "testhook_succeeding" } fn name(&self) -> &'static str { "testhook_succeeding" }
fn set_config(&mut self, _: &Value) { } fn set_config(&mut self, _: &Value) { }
} }
impl HookDataAccessorProvider for SucceedingHook { impl HookDataAccessorProvider for TestHook {
fn accessor(&self) -> HookDataAccessor { fn accessor(&self) -> HookDataAccessor {
use hook::position::HookPosition as HP; use hook::position::HookPosition as HP;
@ -2432,17 +2432,17 @@ mod store_hook_tests {
use storeid::StoreId; use storeid::StoreId;
#[derive(Debug)] #[derive(Debug)]
pub struct SucceedingHookAccessor(HookPosition); pub struct TestHookAccessor(HookPosition);
impl SucceedingHookAccessor { impl TestHookAccessor {
pub fn new(position: HookPosition) -> SucceedingHookAccessor { pub fn new(position: HookPosition) -> TestHookAccessor {
SucceedingHookAccessor(position) TestHookAccessor(position)
} }
} }
impl StoreIdAccessor for SucceedingHookAccessor { impl StoreIdAccessor for TestHookAccessor {
fn access(&self, id: &StoreId) -> HookResult<()> { fn access(&self, id: &StoreId) -> HookResult<()> {
Ok(()) Ok(())
@ -2450,7 +2450,7 @@ mod store_hook_tests {
} }
impl MutableHookDataAccessor for SucceedingHookAccessor { impl MutableHookDataAccessor for TestHookAccessor {
fn access_mut(&self, fle: &mut FileLockEntry) -> HookResult<()> { fn access_mut(&self, fle: &mut FileLockEntry) -> HookResult<()> {
Ok(()) Ok(())
@ -2458,7 +2458,7 @@ mod store_hook_tests {
} }
impl NonMutableHookDataAccessor for SucceedingHookAccessor { impl NonMutableHookDataAccessor for TestHookAccessor {
fn access(&self, fle: &FileLockEntry) -> HookResult<()> { fn access(&self, fle: &FileLockEntry) -> HookResult<()> {
Ok(()) Ok(())
@ -2476,7 +2476,7 @@ mod store_hook_tests {
use storeid::StoreId; use storeid::StoreId;
use store::Store; use store::Store;
use self::succeeding_hook::SucceedingHook; use self::test_hook::TestHook;
fn get_store_with_config() -> Store { fn get_store_with_config() -> Store {
use toml::Parser; use toml::Parser;
@ -2514,7 +2514,7 @@ aspect = "test"
fn test_pre_create() { fn test_pre_create() {
let mut store = get_store_with_config(); let mut store = get_store_with_config();
let pos = HP::PreCreate; let pos = HP::PreCreate;
let hook = SucceedingHook::new(pos.clone()); let hook = TestHook::new(pos.clone());
assert!(store.register_hook(pos, "test", Box::new(hook)).map_err(|e| println!("{:?}", e)).is_ok()); assert!(store.register_hook(pos, "test", Box::new(hook)).map_err(|e| println!("{:?}", e)).is_ok());