MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestPackAlwaysKeepsNewest

Function TestPackAlwaysKeepsNewest

internal/ctx/ctx_test.go:114–127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

112}
113
114func TestPackAlwaysKeepsNewest(t *testing.T) {
115 massive := strings.Repeat("z", 4*10000)
116 history := []Message{
117 {Role: RoleUser, Content: "small"},
118 {Role: RoleUser, Content: massive},
119 }
120 r := Pack(history, 100)
121 if len(r.Messages) != 1 {
122 t.Fatalf("expected only newest kept, got %d", len(r.Messages))
123 }
124 if r.Messages[0].Content != massive {
125 t.Fatal("newest should have been kept even if over budget")
126 }
127}
128
129// TestPackDropsOrphanToolMessage: if budget-trimming cuts the assistant whose
130// tool_calls spawned a tool message, that orphan must be dropped, else

Callers

nothing calls this directly

Calls 1

PackFunction · 0.85

Tested by

no test coverage detected