()
| 428 | |
| 429 | #[tokio::test] |
| 430 | async fn test_registry_execute_with_context_success() { |
| 431 | let registry = ToolRegistry::new(PathBuf::from("/tmp")); |
| 432 | let ctx = ToolContext::new(PathBuf::from("/tmp")); |
| 433 | let trace_sink = InMemoryTraceSink::default(); |
| 434 | registry.set_trace_sink(Arc::new(trace_sink.clone())); |
| 435 | |
| 436 | registry.register(Arc::new(MockTool { |
| 437 | name: "my_tool".to_string(), |
| 438 | })); |
| 439 | |
| 440 | let result = registry |
| 441 | .execute_with_context("my_tool", &serde_json::json!({}), &ctx) |
| 442 | .await |
| 443 | .unwrap(); |
| 444 | assert_eq!(result.name, "my_tool"); |
| 445 | assert_eq!(result.exit_code, 0); |
| 446 | assert_eq!(result.output, "mock output"); |
| 447 | |
| 448 | let events = trace_sink.events(); |
| 449 | assert_eq!(events.len(), 1); |
| 450 | assert_eq!(events[0].kind, TraceEventKind::ToolExecution); |
| 451 | assert_eq!(events[0].name, "my_tool"); |
| 452 | assert!(events[0].success); |
| 453 | assert_eq!(events[0].output_bytes, "mock output".len()); |
| 454 | } |
| 455 | |
| 456 | #[tokio::test] |
| 457 | async fn test_registry_execute_with_context_unknown_tool() { |
nothing calls this directly
no test coverage detected