返回 DeepSeek-Reasonix
controller_clear_test.go
根目录 / internal / control / controller_clear_test.go
1 package control
2
3 import (
4 "strings"
5 "testing"
6
7 "reasonix/internal/agent"
8 "reasonix/internal/event"
9 "reasonix/internal/session"
10 )
11
12 func TestClearSessionRefusesWhileTurnRuns(t *testing.T) {
13 exec := agent.New(nil, nil, agent.NewSession("sys"), agent.Options{}, event.Discard)
14 c := newOwnedTestController(t, Options{Executor: exec})
15 c.mu.Lock()
16 c.turns.phase = session.RuntimeRunning
17 c.mu.Unlock()
18
19 err := c.ClearSession()
20 if err == nil || !IsSessionRotationBusy(err) || !strings.Contains(err.Error(), "cannot clear while a turn is running") {
21 t.Fatalf("ClearSession while running = %v, want classified busy error", err)
22 }
23 }
24
24 lines GO