MCPcopy
hub / github.com/syncthing/syncthing / readFile

Function readFile

lib/versioner/trashcan_test.go:170–182  ·  view source on GitHub ↗
(t *testing.T, filesystem fs.Filesystem, name string)

Source from the content-addressed store, hash-verified

168}
169
170func readFile(t *testing.T, filesystem fs.Filesystem, name string) string {
171 t.Helper()
172 fd, err := filesystem.Open(name)
173 if err != nil {
174 t.Fatal(err)
175 }
176 defer fd.Close()
177 buf, err := io.ReadAll(fd)
178 if err != nil {
179 t.Fatal(err)
180 }
181 return string(buf)
182}
183
184func writeFile(t *testing.T, filesystem fs.Filesystem, name, content string) {
185 fd, err := filesystem.OpenFile(name, fs.OptReadWrite|fs.OptCreate, 0o777)

Calls 4

HelperMethod · 0.80
FatalMethod · 0.80
OpenMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected