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

Function TestBashTimeoutCappedAtOneHour

internal/tools/bash_test.go:146–160  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

144}
145
146func TestBashTimeoutCappedAtOneHour(t *testing.T) {
147 // 999999s must clamp to 3600. Can't sleep an hour to prove it, so a short
148 // command just has to complete quickly: no overflow, no panic.
149 call := chmctx.ToolCall{
150 ID: "t2", Name: "bash",
151 Arguments: map[string]any{
152 "cmd": "echo clamped",
153 "timeout_seconds": float64(999999),
154 },
155 }
156 msg := Execute(context.Background(), call)
157 if !strings.Contains(msg.Content, "clamped") {
158 t.Fatalf("expected echo output: %q", msg.Content)
159 }
160}
161
162// TestBashTimeoutOverflowClamped: extreme floats must be clamped BEFORE the
163// Duration multiply. `time.Duration(1e18) * time.Second` overflows int64 to a

Callers

nothing calls this directly

Calls 1

ExecuteFunction · 0.85

Tested by

no test coverage detected