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

Function TestEditFileRefusesNonRegular

internal/tools/nonregular_unix_test.go:69–81  ·  view source on GitHub ↗

TestEditFileRefusesNonRegular: edit_file reads the target first, so it needs the same guard as read_file.

(t *testing.T)

Source from the content-addressed store, hash-verified

67// TestEditFileRefusesNonRegular: edit_file reads the target first, so it needs
68// the same guard as read_file.
69func TestEditFileRefusesNonRegular(t *testing.T) {
70 path := mkfifo(t)
71 done := make(chan string, 1)
72 go func() { done <- EditFile(path, "a", "b") }()
73 select {
74 case got := <-done:
75 if !strings.Contains(got, "not a regular file") {
76 t.Fatalf("want a not-a-regular-file refusal, got %q", got)
77 }
78 case <-timeoutC(t):
79 t.Fatal("EditFile blocked on the FIFO instead of refusing")
80 }
81}

Callers

nothing calls this directly

Calls 3

mkfifoFunction · 0.85
EditFileFunction · 0.85
timeoutCFunction · 0.85

Tested by

no test coverage detected