MCPcopy Create free account
hub / github.com/openclaw/gogcli / TestRunJSONShellHookUsesRuntimeStderr

Function TestRunJSONShellHookUsesRuntimeStderr

internal/cmd/poll_test.go:422–435  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

420}
421
422func TestRunJSONShellHookUsesRuntimeStderr(t *testing.T) {
423 command := "cat"
424 if os.PathSeparator == '\\' {
425 command = "more"
426 }
427 var diagnostics bytes.Buffer
428 ctx := newCmdRuntimeOutputContext(t, io.Discard, &diagnostics)
429 if err := runJSONShellHook(ctx, command, map[string]any{"event": "changed"}); err != nil {
430 t.Fatalf("runJSONShellHook: %v", err)
431 }
432 if got := diagnostics.String(); !strings.Contains(got, `"event":"changed"`) {
433 t.Fatalf("unexpected hook output: %q", got)
434 }
435}
436
437func newDrivePollTestContext(t *testing.T, svc *drive.Service, stdout io.Writer) context.Context {
438 t.Helper()

Callers

nothing calls this directly

Calls 3

runJSONShellHookFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected