MCPcopy
hub / github.com/restic/restic / verifyFileContentOpenFile

Function verifyFileContentOpenFile

internal/fs/fs_reader_test.go:18–29  ·  view source on GitHub ↗
(t testing.TB, fs FS, filename string, want []byte)

Source from the content-addressed store, hash-verified

16)
17
18func verifyFileContentOpenFile(t testing.TB, fs FS, filename string, want []byte) {
19 f, err := fs.OpenFile(filename, O_RDONLY, false)
20 test.OK(t, err)
21
22 buf, err := io.ReadAll(f)
23 test.OK(t, err)
24 test.OK(t, f.Close())
25
26 if !cmp.Equal(want, buf) {
27 t.Error(cmp.Diff(want, buf))
28 }
29}
30
31func verifyDirectoryContents(t testing.TB, fs FS, dir string, want []string) {
32 f, err := fs.OpenFile(dir, O_RDONLY, false)

Callers 1

createFileTestFunction · 0.85

Calls 5

OKFunction · 0.92
EqualMethod · 0.80
OpenFileMethod · 0.65
CloseMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected