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

Function TestBuildToolsExposesExactlyFourTools

internal/tui/tui_test.go:1102–1119  ·  view source on GitHub ↗

TestBuildToolsExposesExactlyFourTools pins the tool roster: bash, read_file, write_file, edit_file, in that order, with no loop/control tool. Order is part of the contract: the model sees the tools in the payload in this sequence.

(t *testing.T)

Source from the content-addressed store, hash-verified

1100// write_file, edit_file, in that order, with no loop/control tool. Order is
1101// part of the contract: the model sees the tools in the payload in this sequence.
1102func TestBuildToolsExposesExactlyFourTools(t *testing.T) {
1103 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
1104 got := m.buildTools()
1105 want := []string{
1106 tools.BashName,
1107 tools.ReadFileName,
1108 tools.WriteFileName,
1109 tools.EditFileName,
1110 }
1111 if len(got) != len(want) {
1112 t.Fatalf("buildTools returned %d tools, want %d: %+v", len(got), len(want), got)
1113 }
1114 for i, name := range want {
1115 if got[i].Function.Name != name {
1116 t.Fatalf("tool[%d] = %q, want %q (order matters)", i, got[i].Function.Name, name)
1117 }
1118 }
1119}
1120
1121// TestTurnEndsWhenAssistantEmitsNoToolCalls pins the turn-end contract: a final
1122// assistant message with no tool calls returns to phaseIdle and hands control

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
buildToolsMethod · 0.80

Tested by

no test coverage detected