MCPcopy Index your code
hub / github.com/AI45Lab/Code / test_engine_fire_with_block_handler

Function test_engine_fire_with_block_handler

core/src/hooks/engine.rs:608–625  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

606
607 #[tokio::test]
608 async fn test_engine_fire_with_block_handler() {
609 let engine = HookEngine::new();
610 engine.register(Hook::new("test-hook", HookEventType::PreToolUse));
611 engine.register_handler(
612 "test-hook",
613 Arc::new(BlockHandler {
614 reason: "Dangerous command".to_string(),
615 }),
616 );
617
618 let event = make_pre_tool_event("s1", "Bash");
619 let result = engine.fire(&event).await;
620
621 assert!(result.is_block());
622 if let HookResult::Block(reason) = result {
623 assert_eq!(reason, "Dangerous command");
624 }
625 }
626
627 #[tokio::test]
628 async fn test_engine_fire_priority_order() {

Callers

nothing calls this directly

Calls 4

register_handlerMethod · 0.80
make_pre_tool_eventFunction · 0.70
registerMethod · 0.45
fireMethod · 0.45

Tested by

no test coverage detected