MCPcopy
hub / github.com/cortesi/devd / TestServeFileFromCWD

Function TestServeFileFromCWD

fileserver/fileserver_test.go:376–390  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

374}
375
376func TestServeFileFromCWD(t *testing.T) {
377 defer afterTest(t)
378 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
379 ServeFile(w, r, "fileserver_test.go")
380 }))
381 defer ts.Close()
382 r, err := http.Get(ts.URL)
383 if err != nil {
384 t.Fatal(err)
385 }
386 _ = r.Body.Close()
387 if r.StatusCode != 200 {
388 t.Fatalf("expected 200 OK, got %s", r.Status)
389 }
390}
391
392func TestServeFileWithContentEncoding(t *testing.T) {
393 defer afterTest(t)

Callers

nothing calls this directly

Calls 3

afterTestFunction · 0.85
ServeFileFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected