X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/000ae97acb21a1c0c90e9278177a74411ba6eab2..3cdbd017da9ae7a7045f4272f16d4b262fd01c79:/tools_test.go?ds=inline diff --git a/tools_test.go b/tools_test.go index 45cd4a2..487a5fc 100644 --- a/tools_test.go +++ b/tools_test.go @@ -93,6 +93,7 @@ func TestShellInterruptKillsTheCommandAndItsChildren(t *testing.T) { start := time.Now() output := box.shell(ctx, "echo started; sleep 30 & sleep 30") + require.Less(t, time.Since(start), 10*time.Second) require.Equal(t, "started\n\n[interrupted]", output) } @@ -107,7 +108,7 @@ func TestFileTools(t *testing.T) { require.Equal(t, "error: old occurs 2 times in "+path+", not once", box.run(t.Context(), "edit", `{"path":"notes/a.txt","old":"two","new":"2"}`)) require.Equal(t, "edited "+path, box.run(t.Context(), "edit", `{"path":"notes/a.txt","old":"one","new":"1"}`)) require.Equal(t, "1 two two\n", box.run(t.Context(), "read", `{"path":"notes/a.txt"}`)) - require.Contains(t, box.run(t.Context(), "read", `{"path":"missing.txt"}`), "error: open "+filepath.Join(dir, "missing.txt")) + require.Contains(t, box.run(t.Context(), "read", `{"path":"missing.txt"}`), "error: open tool file: open "+filepath.Join(dir, "missing.txt")) require.Equal(t, `error: arguments: json: unknown field "file"`, box.run(t.Context(), "read", `{"file":"a.txt"}`)) require.Equal(t, `error: unknown tool "grep"`, box.run(t.Context(), "grep", `{}`)) }