返回 DeepSeek-Reasonix
errors_test.go
根目录 / internal / agent / errors_test.go
1 package agent
2
3 import (
4 "errors"
5 "fmt"
6 "testing"
7 )
8
9 func TestFinalReadinessErrorPreservesDiagnosticText(t *testing.T) {
10 err := (&FinalReadinessError{Attempts: 3, Reason: "missing verification"}).Error()
11 want := "final-answer readiness failed 3 times: missing verification"
12 if err != want {
13 t.Fatalf("Error() = %q, want %q", err, want)
14 }
15 }
16
17 func TestPauseClassNamesEachGuard(t *testing.T) {
18 for _, tc := range []struct {
19 err error
20 want string
21 }{
22 {&maxStepsPause{steps: 40, key: "max_steps"}, "max_steps"},
23 {&todoStallPause{rounds: 12}, "todo_stall"},
24 {&FinalReadinessError{Attempts: 3}, "final_readiness"},
25 {&RecoveryPauseError{Message: "paused"}, "recovery_paused"},
26 {fmt.Errorf("wrapped: %w", &maxStepsPause{steps: 5}), "max_steps"},
27 {errors.New("provider 500"), ""},
28 {nil, ""},
29 } {
30 if got := PauseClass(tc.err); got != tc.want {
31 t.Errorf("PauseClass(%v) = %q, want %q", tc.err, got, tc.want)
32 }
33 }
34 }
35
35 lines GO