(t *testing.T)
| 310 | } |
| 311 | |
| 312 | func TestMarkStepCompleted(t *testing.T) { |
| 313 | plan := NewExecutionPlan("Test plan") |
| 314 | plan.AddStep("tool1", "Step 1", nil) |
| 315 | |
| 316 | plan.MarkStepStarted(0) |
| 317 | time.Sleep(10 * time.Millisecond) // Ensure some duration |
| 318 | plan.MarkStepCompleted(0, "success result") |
| 319 | |
| 320 | step := plan.GetStep(0) |
| 321 | if step.Status != StepStatusCompleted { |
| 322 | t.Errorf("expected status %v, got %v", StepStatusCompleted, step.Status) |
| 323 | } |
| 324 | |
| 325 | if step.Result != "success result" { |
| 326 | t.Errorf("expected result %q, got %v", "success result", step.Result) |
| 327 | } |
| 328 | |
| 329 | if step.CompletedAt == nil { |
| 330 | t.Error("expected CompletedAt to be set") |
| 331 | } |
| 332 | |
| 333 | if step.DurationMs <= 0 { |
| 334 | t.Errorf("expected positive duration, got %d", step.DurationMs) |
| 335 | } |
| 336 | |
| 337 | // Invalid index should not panic |
| 338 | plan.MarkStepCompleted(-1, nil) |
| 339 | plan.MarkStepCompleted(100, nil) |
| 340 | } |
| 341 | |
| 342 | func TestMarkStepFailed(t *testing.T) { |
| 343 | plan := NewExecutionPlan("Test plan") |
nothing calls this directly
no test coverage detected