X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/522d7fd117285e4e4ce3ea5ec9b5a1722521b681..c781f79f3c8cb9a7577ee1574d196988da2719b3:/tools_test.go?ds=sidebyside diff --git a/tools_test.go b/tools_test.go index 487a5fc..23507f6 100644 --- a/tools_test.go +++ b/tools_test.go @@ -29,6 +29,7 @@ func TestToolRunsAfterItsCallIsDurable(t *testing.T) { "flush, marker absent", "echo: done\n", }, log.Events()) + require.FileExists(t, filepath.Join(dir, "ran")) } @@ -223,6 +224,26 @@ type ToolRecordingLog struct { events []string } +// newTestToolbox returns a toolbox with log, an empty chat, and the working +// directory dir. +func newTestToolbox(t *testing.T, log ToolLog, dir string) *Toolbox { + t.Helper() + + memory, err := openMemory(t.Context(), t.TempDir(), newTestClock().Now, newFakeSummarizer(), discardLog()) + require.NoError(t, err) + + t.Cleanup(func() { + require.NoError(t, memory.Close()) + }) + + return &Toolbox{ + log: log, + chat: memory, + subagents: newTestSubagents(t), + workdir: dir, + } +} + func (r *ToolRecordingLog) Append(kind, text string) (Message, error) { r.mutex.Lock() defer r.mutex.Unlock() @@ -253,23 +274,3 @@ func (r *ToolRecordingLog) Events() []string { return append([]string(nil), r.events...) } - -// newTestToolbox returns a toolbox with log, an empty chat, and the working -// directory dir. -func newTestToolbox(t *testing.T, log ToolLog, dir string) *Toolbox { - t.Helper() - - memory, err := openMemory(t.Context(), t.TempDir(), newTestClock().Now, newFakeSummarizer(), discardLog()) - require.NoError(t, err) - - t.Cleanup(func() { - require.NoError(t, memory.Close()) - }) - - return &Toolbox{ - log: log, - chat: memory, - subagents: newTestSubagents(t), - workdir: dir, - } -}