MCPcopy Create free account
hub / github.com/bufbuild/buf / TestFileCancel

Function TestFileCancel

private/pkg/tmp/tmp_test.go:43–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestFileCancel(t *testing.T) {
44 t.Parallel()
45 ctx, cancel := context.WithCancel(t.Context())
46 tmpFile, err := NewFile(ctx, strings.NewReader("foo"))
47 require.NoError(t, err)
48 _, err = os.ReadFile(tmpFile.Path())
49 assert.NoError(t, err)
50 cancel()
51 time.Sleep(1 * time.Second)
52 _, err = os.ReadFile(tmpFile.Path())
53 assert.Error(t, err)
54}
55
56func TestDir(t *testing.T) {
57 t.Parallel()

Callers

nothing calls this directly

Calls 3

PathMethod · 0.95
NewFileFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…