(t *testing.T)
| 477 | } |
| 478 | |
| 479 | func TestExecuteToolNotFound(t *testing.T) { |
| 480 | toolMap := map[string]tools.Tool{ |
| 481 | "tool1": newMockTool("tool1", "result1", nil), |
| 482 | } |
| 483 | |
| 484 | executor := NewExecutor(toolMap) |
| 485 | |
| 486 | plan := NewExecutionPlan("Tool not found test") |
| 487 | plan.AddStep("nonexistent_tool", "Step 1", nil) |
| 488 | plan.Options.RequireApproval = false |
| 489 | |
| 490 | ctx := context.Background() |
| 491 | toolCtx := &tools.ToolContext{AgentID: "test-agent"} |
| 492 | |
| 493 | err := executor.Execute(ctx, plan, toolCtx) |
| 494 | if err == nil { |
| 495 | t.Fatal("expected error for nonexistent tool") |
| 496 | } |
| 497 | |
| 498 | if plan.Steps[0].Status != StepStatusFailed { |
| 499 | t.Errorf("expected step status %v, got %v", StepStatusFailed, plan.Steps[0].Status) |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | func TestExecuteAlreadyExecuting(t *testing.T) { |
| 504 | toolMap := map[string]tools.Tool{ |
nothing calls this directly
no test coverage detected