MCPcopy Create free account
hub / github.com/diillson/chatcli / TestPushDrainMemoryNotices

Function TestPushDrainMemoryNotices

cli/memory_extras_test.go:90–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

88}
89
90func TestPushDrainMemoryNotices(t *testing.T) {
91 cli := &ChatCLI{}
92 cli.pushMemoryNotice("") // empty is ignored
93 cli.pushMemoryNotice("memory: +1 fact")
94 cli.memNoticeMu.Lock()
95 n := len(cli.memNotices)
96 cli.memNoticeMu.Unlock()
97 if n != 1 {
98 t.Fatalf("expected 1 queued notice, got %d", n)
99 }
100 cli.drainMemoryNotices() // prints + clears
101 cli.memNoticeMu.Lock()
102 n = len(cli.memNotices)
103 cli.memNoticeMu.Unlock()
104 if n != 0 {
105 t.Errorf("expected notices drained, got %d", n)
106 }
107}
108
109func TestSnippetAroundHelper(t *testing.T) {
110 // Reuse the session snippet helper to ensure it stays covered/working.

Callers

nothing calls this directly

Calls 5

pushMemoryNoticeMethod · 0.95
drainMemoryNoticesMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected