()
| 737 | |
| 738 | #[tokio::test] |
| 739 | async fn test_engine_skill_hook_with_matcher() { |
| 740 | let engine = HookEngine::new(); |
| 741 | |
| 742 | // Register a hook that only matches specific skill |
| 743 | engine.register( |
| 744 | Hook::new("specific-skill-hook", HookEventType::SkillLoad) |
| 745 | .with_matcher(HookMatcher::skill("my-skill")), |
| 746 | ); |
| 747 | engine.register_handler( |
| 748 | "specific-skill-hook", |
| 749 | Arc::new(BlockHandler { |
| 750 | reason: "Skill blocked".to_string(), |
| 751 | }), |
| 752 | ); |
| 753 | |
| 754 | // Should match and block |
| 755 | let matching_event = make_skill_load_event("my-skill", vec!["tool1"]); |
| 756 | let result = engine.fire(&matching_event).await; |
| 757 | assert!(result.is_block()); |
| 758 | |
| 759 | // Should not match (no hooks match, so continue) |
| 760 | let non_matching_event = make_skill_load_event("other-skill", vec!["tool1"]); |
| 761 | let result = engine.fire(&non_matching_event).await; |
| 762 | assert!(result.is_continue()); |
| 763 | } |
| 764 | |
| 765 | #[tokio::test] |
| 766 | async fn test_engine_skill_hook_pattern_matcher() { |
nothing calls this directly
no test coverage detected