MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestExecuteReadFileWrapsResult

Function TestExecuteReadFileWrapsResult

internal/tools/read_test.go:85–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func TestExecuteReadFileWrapsResult(t *testing.T) {
86 dir := t.TempDir()
87 path := filepath.Join(dir, "in.txt")
88 content := "package main\n\nfunc main() {}\n"
89 if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
90 t.Fatal(err)
91 }
92 call := chmctx.ToolCall{
93 ID: "call_r",
94 Name: ReadFileName,
95 Arguments: map[string]any{"path": path},
96 }
97 msg := Execute(context.Background(), call)
98 if msg.Role != chmctx.RoleTool || msg.ToolCallID != "call_r" || msg.ToolName != ReadFileName {
99 t.Fatalf("bad message: %+v", msg)
100 }
101 if msg.Content != content {
102 t.Fatalf("content mismatch:\n got %q\nwant %q", msg.Content, content)
103 }
104}
105
106func TestInlineStatusReadFile(t *testing.T) {
107 s := InlineStatus(chmctx.ToolCall{

Callers

nothing calls this directly

Calls 1

ExecuteFunction · 0.85

Tested by

no test coverage detected